openapi: 3.1.0 info: title: Salesforce Service Cloud Salesforce Chat REST Accounts Sessions API description: REST API for managing live chat sessions between agents and visitors in Salesforce Service Cloud. Enables initiating chat sessions, sending and receiving messages, and monitoring chat activity. version: '59.0' contact: name: Salesforce Developer Support url: https://developer.salesforce.com/support termsOfService: https://www.salesforce.com/company/legal/agreements/ servers: - url: https://{hostname}/chat/rest description: Chat REST API Endpoint variables: hostname: default: d.la1-c1-ia4.salesforceliveagent.com description: Your Live Agent endpoint hostname security: - apiKey: [] tags: - name: Sessions description: Chat session lifecycle management paths: /System/SessionId: get: operationId: getSessionId summary: Salesforce Service Cloud Get a new session ID description: Generates a unique session ID and key to establish a new chat session. This must be the first request made for every new chat. tags: - Sessions parameters: - $ref: '#/components/parameters/AffinityToken' responses: '200': description: Session ID and key content: application/json: schema: $ref: '#/components/schemas/SessionIdResponse' '403': description: Invalid API version or configuration /Chasitor/ChasitorInit: post: operationId: initiateChatSession summary: Salesforce Service Cloud Initiate a chat session description: Initiates a new chat request from a visitor, placing them in the queue for an available agent. tags: - Sessions requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChasitorInit' responses: '200': description: Chat session initiated '400': description: Invalid request parameters '503': description: No agents available /Chasitor/ChatEnd: post: operationId: endChat summary: Salesforce Service Cloud End a chat session description: Ends the current chat session from the visitor side. tags: - Sessions responses: '200': description: Chat ended successfully '403': description: Invalid session components: schemas: ChasitorInit: type: object required: - organizationId - deploymentId - buttonId - sessionId - visitorName properties: organizationId: type: string description: Salesforce organization ID deploymentId: type: string description: Chat deployment ID buttonId: type: string description: Chat button ID sessionId: type: string description: Session ID from SessionId request visitorName: type: string description: Display name of the visitor prechatDetails: type: array items: type: object description: Pre-chat form field values SessionIdResponse: type: object properties: id: type: string description: The unique session ID key: type: string description: The session key for subsequent requests affinityToken: type: string description: Token for maintaining session affinity clientPollTimeout: type: integer description: Recommended polling interval in seconds parameters: AffinityToken: name: X-LIVEAGENT-AFFINITY in: header required: true description: Affinity token for session routing schema: type: string securitySchemes: apiKey: type: apiKey in: header name: X-LIVEAGENT-API-VERSION description: Live Agent API version header externalDocs: description: Chat REST API Developer Guide url: https://developer.salesforce.com/docs/atlas.en-us.live_agent_rest.meta/live_agent_rest/