{
  "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"
    }
  ],
  "paths": {
    "/s2s/contacts/{userId}": {
      "put": {
        "operationId": "Upsert",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SContact"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Create or update a contact. Returns the full contact including its unread\nconversation count.",
        "summary": "Upsert contact",
        "tags": [
          "S2S Contacts"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "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/S2SUpsertContactBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "Get",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SContact"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Fetch a contact including its unread conversation count.",
        "summary": "Get contact",
        "tags": [
          "S2S Contacts"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "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."
          }
        ]
      },
      "delete": {
        "operationId": "Remove",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "type": "object"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Delete a contact and their conversations (the platform's standard\ncontact deletion — same behaviour as the admin API).",
        "summary": "Delete contact",
        "tags": [
          "S2S Contacts"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "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."
          }
        ]
      }
    },
    "/s2s/contacts/{userId}/events": {
      "post": {
        "operationId": "TrackEvents",
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "received": {
                      "type": "number",
                      "format": "double"
                    }
                  },
                  "required": [
                    "received"
                  ],
                  "type": "object"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Track events for a contact (drives outbound messaging and workflows).",
        "summary": "Track contact events",
        "tags": [
          "S2S Contacts"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2STrackEventsBody"
              }
            }
          }
        }
      }
    },
    "/s2s/contacts/{userId}/conversations": {
      "post": {
        "operationId": "CreateConversation",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SConversation"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Open a conversation for a contact, authored as the contact. Pass\nworkflowId to start a workflow, or agentId to engage an AI agent.\nThe contact is created on the fly if it does not exist yet.",
        "summary": "Create conversation",
        "tags": [
          "S2S Contacts"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SCreateConversationBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListConversations",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "next_cursor": {
                      "type": "string",
                      "nullable": true
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/S2SConversation"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "next_cursor",
                    "has_more",
                    "items"
                  ],
                  "type": "object"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "List the contact's conversations, most recent activity first.\nBot-only conversations without human interaction are hidden — exactly the\nwidget's conversation list.",
        "summary": "List contact conversations",
        "tags": [
          "S2S Contacts"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "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."
          }
        ]
      }
    },
    "/s2s/conversations/{conversationId}": {
      "get": {
        "operationId": "Get",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SConversation"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Fetch a conversation. Attributes are filtered to customer-visible ones.",
        "summary": "Get conversation",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          }
        ]
      },
      "patch": {
        "operationId": "Patch",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SConversation"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Update conversation title and/or attributes (merge semantics).",
        "summary": "Update conversation",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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/S2SPatchConversationBody"
              }
            }
          }
        }
      }
    },
    "/s2s/conversations/{conversationId}/close": {
      "post": {
        "operationId": "Close",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SConversation"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Close the conversation for the contact. Further contact messages are\nrejected with `conversation_closed` until it is reopened.",
        "summary": "Close conversation",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ]
      }
    },
    "/s2s/conversations/{conversationId}/reopen": {
      "post": {
        "operationId": "Reopen",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SConversation"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Reopen a closed conversation.",
        "summary": "Reopen conversation",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ]
      }
    },
    "/s2s/conversations/{conversationId}/read": {
      "post": {
        "operationId": "Read",
        "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"
                }
              }
            }
          }
        },
        "description": "Mark the conversation read for the contact (explicit read receipt).\nClears the contact's unread state for this conversation.",
        "summary": "Mark conversation read",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ]
      }
    },
    "/s2s/conversations/{conversationId}/typing": {
      "post": {
        "operationId": "Typing",
        "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"
                }
              }
            }
          }
        },
        "description": "Signal that the contact is typing (or stopped typing). Debounce on your\nside; send only while a conversation is on screen.",
        "summary": "Typing indicator",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2STypingBody"
              }
            }
          }
        }
      }
    },
    "/s2s/conversations/{conversationId}/network-logs": {
      "put": {
        "operationId": "SetNetworkLogs",
        "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"
                }
              }
            }
          }
        },
        "description": "Attach a network log snapshot to the conversation — the same logs\n`Gleap.logNetwork()` collects in the SDK flow. Shown to agents in the\nconversation's \"Logs\" panel. Each call replaces the previous snapshot\n(max 100 requests, 2 MB). Not delivered via webhooks or the stream.",
        "summary": "Set network logs",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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/S2SPutNetworkLogsBody"
              }
            }
          }
        }
      }
    },
    "/s2s/conversations/{conversationId}/events": {
      "put": {
        "operationId": "SetEvents",
        "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"
                }
              }
            }
          }
        },
        "description": "Attach an event log snapshot to the conversation — the same events\n`Gleap.trackEvent()` buffers in the SDK flow and attaches when a\nconversation is created. Scoped to this conversation only (not the\ncontact), so events from other sessions never mix in. Shown to agents in\nthe conversation's \"Logs\" panel. Each call replaces the previous snapshot\n(max 500 events, 2 MB). Not delivered via webhooks or the stream.\nFor contact-level events that drive outbound rules, use\n`POST /contacts/{userId}/events` instead.",
        "summary": "Set conversation events",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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"
              }
            }
          }
        }
      }
    },
    "/s2s/conversations/{conversationId}/rating": {
      "post": {
        "operationId": "Rate",
        "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"
                }
              }
            }
          }
        },
        "description": "Rate the conversation (CSAT), integer 0–10.",
        "summary": "Rate conversation",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SConversationRatingBody"
              }
            }
          }
        }
      }
    },
    "/s2s/conversations/{conversationId}/messages": {
      "post": {
        "operationId": "SendMessage",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SMessage"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Send a message into the conversation, authored as the contact.",
        "summary": "Send message",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SSendMessageBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListMessages",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "next_after": {
                      "type": "string",
                      "nullable": true
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/S2SMessage"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "next_after",
                    "has_more",
                    "items"
                  ],
                  "type": "object"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Read the conversation's messages, oldest first, cursor-paginated\n(max 100 per page). Pass `after` = the last message id you have.\nReading messages does NOT mark the conversation read — use the explicit\nread receipt.",
        "summary": "List messages",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "conversationId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "after",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "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."
          }
        ]
      }
    },
    "/s2s/conversations/{conversationId}/workflow": {
      "get": {
        "operationId": "PendingWorkflowStep",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "step": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/S2SWorkflowStep"
                        }
                      ],
                      "nullable": true
                    }
                  },
                  "required": [
                    "step"
                  ],
                  "type": "object"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "The workflow step currently waiting for the contact, if any.",
        "summary": "Get pending workflow step",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          }
        ]
      }
    },
    "/s2s/conversations/{conversationId}/workflow/answer": {
      "post": {
        "operationId": "AnswerWorkflowStep",
        "responses": {
          "202": {
            "description": "Accepted"
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Answer the pending workflow step (text, selection, rating, attachments) or\nrequest a human with botAction \"humanHandoff\".",
        "summary": "Answer workflow step",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SWorkflowAnswerBody"
              }
            }
          }
        }
      }
    },
    "/s2s/conversations/{conversationId}/workflow/{workflowId}/run": {
      "post": {
        "operationId": "RunConversationWorkflow",
        "responses": {
          "202": {
            "description": "Accepted"
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Run a specific workflow on this conversation (replaces any active one).",
        "summary": "Run workflow",
        "tags": [
          "S2S Conversations"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "conversationId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "workflowId",
            "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ]
      }
    },
    "/s2s/messages/{messageId}": {
      "get": {
        "operationId": "Get",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SMessage"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Fetch a single message.",
        "summary": "Get message",
        "tags": [
          "S2S Messages"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "messageId",
            "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."
          }
        ]
      }
    },
    "/s2s/messages/{messageId}/rating": {
      "post": {
        "operationId": "Rate",
        "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"
                }
              }
            }
          }
        },
        "description": "Rate a message (thumbs up / down) — typically an AI answer.",
        "summary": "Rate message",
        "tags": [
          "S2S Messages"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "messageId",
            "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SMessageRatingBody"
              }
            }
          }
        }
      }
    },
    "/s2s/stream/config": {
      "get": {
        "operationId": "Config",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SStreamConfig"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Connection parameters. Read these at startup instead of hardcoding —\nif the realtime infrastructure moves, your client follows automatically.",
        "summary": "Get stream config",
        "tags": [
          "S2S Stream"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "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."
          }
        ]
      }
    },
    "/s2s/stream/auth": {
      "post": {
        "operationId": "Auth",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Channel authorization — point your Pusher client's channel auth here with\nyour server key as the Authorization header. A new consumerId takes over\nfrom the previous consumer (its connection is terminated).",
        "summary": "Authorize channel subscription",
        "tags": [
          "S2S Stream"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SStreamAuthBody"
              }
            }
          }
        }
      }
    },
    "/s2s/stream/user-auth": {
      "post": {
        "operationId": "UserAuth",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "User authentication (Pusher signin) — REQUIRED for server-side takeover\ntermination to reach your connection. Configure it as the client's\nuserAuthentication endpoint.",
        "summary": "Authenticate stream user",
        "tags": [
          "S2S Stream"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SStreamUserAuthBody"
              }
            }
          }
        }
      }
    },
    "/s2s/webhooks": {
      "get": {
        "operationId": "List",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/S2SWebhookListItem"
                  },
                  "type": "array"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "List webhook endpoints (secrets masked).",
        "summary": "List webhooks",
        "tags": [
          "S2S Webhooks"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "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."
          }
        ]
      },
      "post": {
        "operationId": "Create",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/S2SWebhookListItem"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Register a webhook endpoint. The signing secret is returned exactly once.",
        "summary": "Create webhook",
        "tags": [
          "S2S Webhooks"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "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."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Makes the POST retryable: a completed successful response replays for 24 hours (Gleap-Idempotency-Replayed: true). Semantics are at-least-once — a retry that races a crashed or >60s-running original may re-execute. Error responses are never stored; retry them normally."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/S2SWebhookCreateBody"
              }
            }
          }
        }
      }
    },
    "/s2s/webhooks/{webhookId}": {
      "delete": {
        "operationId": "Remove",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success"
                  ],
                  "type": "object"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "Delete a webhook endpoint.",
        "summary": "Delete webhook",
        "tags": [
          "S2S Webhooks"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "webhookId",
            "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."
          }
        ]
      }
    },
    "/s2s/workflows": {
      "get": {
        "operationId": "List",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/S2SWorkflowListItem"
                  },
                  "type": "array"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "description": "List the project's live workflows.",
        "summary": "List workflows",
        "tags": [
          "S2S Workflows"
        ],
        "security": [
          {
            "s2s": []
          }
        ],
        "parameters": [
          {
            "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."
          }
        ]
      }
    },
    "/s2s/uploads": {
      "post": {
        "operationId": "S2SUpload",
        "tags": [
          "S2S Uploads"
        ],
        "summary": "Upload a file",
        "description": "Multipart upload (field `file`, max 25 MB). Returned URLs are signed and expire — attach them to a message promptly and never persist them. Idempotency-Key is not supported on multipart uploads (re-uploading is safe: every upload mints a fresh URL).",
        "security": [
          {
            "s2s": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number"
                    },
                    "contentType": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "413": {
            "description": "File exceeds the 25 MB limit.",
            "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"
                }
              }
            }
          }
        }
      }
    },
    "/s2s/uploads/audio": {
      "post": {
        "operationId": "S2SUploadAudio",
        "tags": [
          "S2S Uploads"
        ],
        "summary": "Upload a voice note",
        "description": "Multipart upload (field `file`, max 25 MB). Transcoded to MP3 server-side.",
        "security": [
          {
            "s2s": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "durationMs": {
                      "type": "number",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "413": {
            "description": "File exceeds the 25 MB limit.",
            "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"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "S2SContact": {
        "properties": {
          "userId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "companyId": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "value": {
            "type": "number",
            "format": "double"
          },
          "customData": {
            "$ref": "#/components/schemas/Record_string.unknown_"
          },
          "unread": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastActivityAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "userId"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SUpsertContactBody": {
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "description": "ISO language code, e.g. \"en\", \"az\"."
          },
          "companyId": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "value": {
            "type": "number",
            "format": "double"
          },
          "customData": {
            "description": "Arbitrary custom contact data (flat key→value object)."
          }
        },
        "type": "object",
        "additionalProperties": false
      },
      "S2STrackEventsBody": {
        "properties": {
          "events": {
            "items": {
              "$ref": "#/components/schemas/S2STrackEventItem"
            },
            "type": "array"
          }
        },
        "required": [
          "events"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SConversation": {
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "number",
            "format": "double"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "closed": {
            "type": "boolean"
          },
          "archived": {
            "type": "boolean"
          },
          "unread": {
            "type": "boolean"
          },
          "workflowActive": {
            "type": "boolean"
          },
          "workflowId": {
            "type": "string"
          },
          "assignee": {
            "allOf": [
              {
                "$ref": "#/components/schemas/S2SAuthor"
              }
            ],
            "nullable": true
          },
          "attributes": {
            "$ref": "#/components/schemas/Record_string.unknown_"
          },
          "contact": {
            "properties": {
              "userId": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "latestMessage": {
            "$ref": "#/components/schemas/S2SMessage"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastActivityAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "closed",
          "archived",
          "unread",
          "workflowActive"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SCreateConversationBody": {
        "properties": {
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "The customer's first message."
          },
          "attributes": {
            "description": "Ticket attributes (data attributes); agent-only when the attribute's shared visibility is disabled."
          },
          "source": {
            "type": "string",
            "description": "Free-form source tag, e.g. \"abb-mobile\"."
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "attachments": {
            "items": {
              "$ref": "#/components/schemas/S2SAttachmentInput"
            },
            "type": "array"
          },
          "workflowId": {
            "type": "string",
            "description": "Start this workflow immediately (wf_… or bare id). Mutually exclusive with agentId."
          },
          "agentId": {
            "type": "string",
            "description": "Engage this AI agent directly. Mutually exclusive with workflowId."
          }
        },
        "required": [
          "message"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SPatchConversationBody": {
        "properties": {
          "title": {
            "type": "string"
          },
          "attributes": {
            "description": "Attribute keys to set (merged into the existing attributes)."
          }
        },
        "type": "object",
        "additionalProperties": false
      },
      "S2STypingBody": {
        "properties": {
          "typing": {
            "type": "boolean"
          }
        },
        "required": [
          "typing"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SPutNetworkLogsBody": {
        "properties": {
          "requests": {
            "items": {
              "$ref": "#/components/schemas/S2SNetworkLogRequestInput"
            },
            "type": "array",
            "description": "Snapshot of recent network requests (max 100 entries, 2 MB). Replaces any previous snapshot for this conversation."
          }
        },
        "required": [
          "requests"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "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
      },
      "S2SConversationRatingBody": {
        "properties": {
          "rating": {
            "type": "number",
            "format": "double",
            "description": "Integer 0–10."
          }
        },
        "required": [
          "rating"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SMessage": {
        "properties": {
          "id": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "author": {
            "$ref": "#/components/schemas/S2SAuthor"
          },
          "attachments": {
            "items": {
              "$ref": "#/components/schemas/S2SAttachment"
            },
            "type": "array"
          },
          "replyToMessageId": {
            "type": "string"
          },
          "rating": {
            "type": "string"
          },
          "unread": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "conversationId",
          "author",
          "attachments",
          "unread",
          "createdAt"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SSendMessageBody": {
        "properties": {
          "text": {
            "type": "string"
          },
          "attachments": {
            "items": {
              "$ref": "#/components/schemas/S2SAttachmentInput"
            },
            "type": "array"
          },
          "replyToMessageId": {
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SWorkflowStep": {
        "properties": {
          "workflowId": {
            "type": "string"
          },
          "stepType": {
            "type": "string"
          },
          "actionFlowId": {
            "type": "string"
          },
          "actionId": {
            "type": "number",
            "format": "double"
          },
          "action": {
            "$ref": "#/components/schemas/Record_string.unknown_"
          }
        },
        "type": "object",
        "additionalProperties": false
      },
      "S2SWorkflowAnswerBody": {
        "properties": {
          "text": {
            "type": "string",
            "description": "Free-text answer (input / chat steps)."
          },
          "selected": {
            "type": "string",
            "description": "Selected option value (button / select steps)."
          },
          "rating": {
            "type": "number",
            "format": "double",
            "description": "Rating value (rate-conversation steps)."
          },
          "attachments": {
            "items": {
              "$ref": "#/components/schemas/S2SAttachmentInput"
            },
            "type": "array"
          },
          "botAction": {
            "type": "string",
            "enum": [
              "humanHandoff"
            ],
            "nullable": false,
            "description": "\"humanHandoff\" requests a human without waking an agent run."
          }
        },
        "type": "object",
        "additionalProperties": false
      },
      "S2SMessageRatingBody": {
        "properties": {
          "rating": {
            "type": "string",
            "enum": [
              "positive",
              "negative"
            ]
          }
        },
        "required": [
          "rating"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SStreamConfig": {
        "properties": {
          "protocol": {
            "type": "string",
            "enum": [
              "pusher"
            ],
            "nullable": false
          },
          "host": {
            "type": "string"
          },
          "port": {
            "type": "number",
            "format": "double"
          },
          "tls": {
            "type": "boolean"
          },
          "appKey": {
            "type": "string"
          },
          "channel": {
            "type": "string"
          },
          "authEndpoint": {
            "type": "string"
          },
          "userAuthEndpoint": {
            "type": "string"
          }
        },
        "required": [
          "protocol",
          "host",
          "port",
          "tls",
          "appKey",
          "channel",
          "authEndpoint",
          "userAuthEndpoint"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SStreamAuthBody": {
        "properties": {
          "socket_id": {
            "type": "string"
          },
          "channel_name": {
            "type": "string"
          },
          "consumerId": {
            "type": "string",
            "description": "Identifies the connecting backend instance; a new consumerId takes over."
          },
          "typingEvents": {
            "type": "boolean",
            "description": "Opt this stream into agent.typing.* events (high volume; default off)."
          }
        },
        "required": [
          "socket_id",
          "channel_name",
          "consumerId"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SStreamUserAuthBody": {
        "properties": {
          "socket_id": {
            "type": "string"
          },
          "consumerId": {
            "type": "string"
          }
        },
        "required": [
          "socket_id",
          "consumerId"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SWebhookListItem": {
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "events": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": {
            "type": "string"
          },
          "secret": {
            "type": "string",
            "description": "Masked; the full secret is returned once at creation."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "url",
          "enabled",
          "events",
          "secret",
          "createdAt"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SWebhookCreateBody": {
        "properties": {
          "url": {
            "type": "string"
          },
          "events": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "description": "Event types to deliver; omit for all."
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SWorkflowListItem": {
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "Record_string.unknown_": {
        "properties": {},
        "type": "object",
        "description": "Construct a type with a set of properties K of type T"
      },
      "S2STrackEventItem": {
        "properties": {
          "name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "description": "ISO timestamp; defaults to now."
          },
          "data": {
            "description": "Arbitrary event payload (flat key→value object)."
          }
        },
        "required": [
          "name"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SAuthor": {
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "contact",
              "agent",
              "bot",
              "system"
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "avatar": {
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SAttachmentInput": {
        "properties": {
          "url": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "S2SNetworkLogRequestInput": {
        "properties": {
          "url": {
            "type": "string",
            "description": "Full request URL."
          },
          "type": {
            "type": "string",
            "description": "HTTP method, e.g. \"GET\"."
          },
          "date": {
            "type": "string",
            "description": "ISO timestamp of the request."
          },
          "duration": {
            "type": "number",
            "format": "double",
            "description": "Duration in milliseconds."
          },
          "success": {
            "type": "boolean"
          },
          "request": {
            "description": "Request details, e.g. { headers, payload }."
          },
          "response": {
            "description": "Response details, e.g. { status, responseText }."
          },
          "initiatorType": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "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
      },
      "S2SAttachment": {
        "properties": {
          "url": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "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"
        ]
      }
    },
    "securitySchemes": {
      "s2s": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Service account token (JWT)"
      }
    }
  }
}