> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gleap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Set conversation events

> Attach an event log snapshot to the conversation — the same events
`Gleap.trackEvent()` buffers in the SDK flow and attaches when a
conversation is created. Scoped to this conversation only (not the
contact), so events from other sessions never mix in. Shown to agents in
the conversation's "Logs" panel. Each call replaces the previous snapshot
(max 500 events, 2 MB). Not delivered via webhooks or the stream.
For contact-level events that drive outbound rules, use
`POST /contacts/{userId}/events` instead.



## OpenAPI

````yaml /openapi/s2s-openapi.json put /s2s/conversations/{conversationId}/events
openapi: 3.0.0
info:
  title: Gleap Server-to-Server Conversations API
  version: '2026-08-01'
  description: >-
    Headless access to Gleap conversations: contacts, conversations, messages,
    workflows, uploads, webhooks and the realtime stream — authenticated with
    your project's service account token.
servers:
  - url: https://api.gleap.io/v3
security: []
paths:
  /s2s/conversations/{conversationId}/events:
    put:
      tags:
        - S2S Conversations
      summary: Set conversation events
      description: >-
        Attach an event log snapshot to the conversation — the same events

        `Gleap.trackEvent()` buffers in the SDK flow and attaches when a

        conversation is created. Scoped to this conversation only (not the

        contact), so events from other sessions never mix in. Shown to agents in

        the conversation's "Logs" panel. Each call replaces the previous
        snapshot

        (max 500 events, 2 MB). Not delivered via webhooks or the stream.

        For contact-level events that drive outbound rules, use

        `POST /contacts/{userId}/events` instead.
      operationId: SetEvents
      parameters:
        - in: path
          name: conversationId
          required: true
          schema:
            type: string
        - name: Gleap-Version
          in: header
          required: false
          schema:
            type: string
            example: '2026-08-01'
          description: Pin a specific API version; defaults to the current version.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/S2SPutConversationEventsBody'
      responses:
        '204':
          description: No Content
        '401':
          description: Missing, invalid or revoked service account token.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: The addressed resource does not exist in this project.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '422':
          description: Idempotency-Key reuse with a different request body.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: Rate limit exceeded — honor the Retry-After header.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        default:
          description: >-
            Any other error, including validation_failed (400) and
            internal_error (500).
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - s2s: []
components:
  schemas:
    S2SPutConversationEventsBody:
      properties:
        events:
          items:
            $ref: '#/components/schemas/S2SConversationEventInput'
          type: array
          description: >-
            Snapshot of the events that led up to this conversation (max 500
            entries, 2 MB). Replaces any previous snapshot for this
            conversation.
      required:
        - events
      type: object
      additionalProperties: false
    Problem:
      type: object
      description: >-
        RFC 9457 problem details — every error response uses this shape
        (application/problem+json).
      properties:
        type:
          type: string
          example: https://docs.gleap.io/s2s/problems/conversation_closed
        title:
          type: string
        status:
          type: number
        code:
          type: string
          example: conversation_closed
        detail:
          type: string
        request_id:
          type: string
          example: req_66c0ffee0000000000000001
      required:
        - type
        - title
        - status
        - code
    S2SConversationEventInput:
      properties:
        name:
          type: string
          description: Event name, e.g. "screen_opened" or "pageView".
        date:
          type: string
          description: ISO timestamp of when the event happened; defaults to now.
        data:
          description: Arbitrary event payload (flat key→value object).
      required:
        - name
      type: object
      additionalProperties: false
  securitySchemes:
    s2s:
      type: http
      scheme: bearer
      bearerFormat: Service account token (JWT)

````