Chat

post/chat

Have a conversation with Glean AI. Responses will be sent as data-only server-sent events as they become available line by line. Each line will be a ChatResponse. Please reach out to the Glean support team for access to this API.

SecurityBearerAuth
Request
query Parameters
timezoneOffset
integer

The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.

header Parameters
X-Scio-Actas
string <email>

Email address of a user on whose behalf the request is intended to be made (should be non-empty only for global tokens).

Request Body schema: application/json
required

Includes chat history for Glean AI to respond to.

required
Array of objects (ChatMessage)

A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query.

object (AgentConfig)

Describes the agent that executes the request.

applicationId
string

The ID of the application this request originates from, used to determine the configuration of underlying chat processes. This should correspond to the ID set during admin setup. If not specified, the default chat experience will be used.

chatId
string

The id of the Chat that this message should be added to. An empty id signifies creating a new Chat if saveChat is true.

object (RestrictionFilters)
object (RestrictionFilters)
saveChat
boolean

Save the current interaction as a Chat for the user to access later.

stream
boolean

Whether to stream responses as they become available. If false, the entire response will be returned at once. Note if true and the model being used does not support streaming, the model's response will not be streamed but other messages from the endpoint still will.

timeoutMillis
integer

Timeout in milliseconds for the request. A 408 error will be returned if handling the request takes longer.

Responses
200

OK

Response Schema: application/json
backendTimeMillis
integer <int64>

Time in milliseconds the backend took to respond to the request.

chatId
string

The id of the associated Chat the messages belong to, if one exists.

chatSessionTrackingToken
string

A token that is used to track the session.

followUpPrompts
Array of strings

Follow-up prompts for the user to potentially use

Array of objects (ChatMessage)
400

Invalid request

401

Not Authorized

408

Request Timeout

429

Too Many Requests

Request samples
application/json
{
  • "messages": [
    • {
      • "author": "USER",
      • "fragments": [
        • {
          • "text": "What are the company holidays this year?"
          }
        ]
      }
    ]
}
Response samples
application/json
{
  • "messages": [
    • {
      • "agentConfig": {
        • "agent": "DEFAULT",
        • "mode": "DEFAULT"
        },
      • "author": "USER",
      • "citations": [
        • {
          • "trackingToken": "string",
          • "sourceDocument": {
            • "id": "string",
            • "datasource": "string",
            • "connectorType": "API_CRAWL",
            • "docType": "string",
            • "content": {
              • "fullTextList": [
                • null
                ]
              },
            • "containerDocument": { },
            • "parentDocument": { },
            • "title": "string",
            • "url": "string",
            • "metadata": {
              • "container": "container",
              • "parentId": "JIRA_EN-1337",
              • "createTime": "2000-01-23T04:56:07.000Z",
              • "datasource": "datasource",
              • "author": {
                • "name": "name"
                },
              • "documentId": "documentId",
              • "updateTime": "2000-01-23T04:56:07.000Z",
              • "mimeType": "mimeType",
              • "objectType": "Feature Request",
              • "components": [
                • "Backend",
                • "Networking"
                ],
              • "status": [
                • "Done"
                ],
              • "customData": {
                • "someCustomField": "someCustomValue"
                }
              },
            • "sections": [
              • {
                • "title": null,
                • "url": null
                }
              ]
            },
          • "sourceFile": {
            • "id": "FILE_1234",
            • "name": "sample.pdf",
            • "metadata": {
              • "status": "PROCESSING",
              • "uploadTime": 0,
              • "processedSize": 0,
              • "failureReason": "PARSE_FAILED"
              }
            },
          • "sourcePerson": {
            • "name": "George Clooney",
            • "obfuscatedId": "abc123"
            },
          • "referenceRanges": [
            • {
              • "textRange": {
                • "startIndex": null,
                • "endIndex": null,
                • "type": null,
                • "url": null,
                • "document": null
                },
              • "snippets": [
                • null
                ]
              }
            ]
          }
        ],
      • "uploadedFileIds": [
        • "string"
        ],
      • "fragments": [
        • {
          • "structuredResults": [
            • {
              • "document": {
                • "id": null,
                • "datasource": null,
                • "connectorType": null,
                • "docType": null,
                • "content": null,
                • "containerDocument": null,
                • "parentDocument": null,
                • "title": null,
                • "url": null,
                • "metadata": null,
                • "sections": [ ]
                },
              • "person": {
                • "name": "George Clooney",
                • "obfuscatedId": "abc123"
                },
              • "customer": {
                • "id": null,
                • "domains": [ ],
                • "company": null,
                • "documentCounts": null,
                • "poc": [ ],
                • "metadata": null,
                • "mergedCustomers": [ ],
                • "startDate": null,
                • "contractAnnualRevenue": null,
                • "notes": null
                },
              • "team": {
                • "relatedObjects": { },
                • "permissions": null,
                • "id": null,
                • "name": null,
                • "description": null,
                • "businessUnit": null,
                • "department": null,
                • "photoUrl": null,
                • "bannerUrl": null,
                • "externalLink": null,
                • "members": [ ],
                • "memberCount": null,
                • "emails": [ ],
                • "datasourceProfiles": [ ],
                • "datasource": null,
                • "createdFrom": null,
                • "lastUpdatedAt": null,
                • "status": null,
                • "canBeDeleted": null,
                • "loggingId": null
                },
              • "customEntity": {
                • "permissions": null,
                • "id": null,
                • "title": null,
                • "datasource": null,
                • "objectType": null,
                • "metadata": null,
                • "roles": [ ]
                },
              • "answer": {
                • "id": null,
                • "docId": null,
                • "question": null,
                • "questionVariations": [ ],
                • "bodyText": null,
                • "boardId": null,
                • "audienceFilters": [ ],
                • "addedRoles": [ ],
                • "removedRoles": [ ],
                • "roles": [ ],
                • "sourceDocumentSpec": null,
                • "sourceType": null,
                • "permissions": null,
                • "combinedAnswerText": null,
                • "likes": null,
                • "author": null,
                • "createTime": null,
                • "updateTime": null,
                • "updatedBy": null,
                • "verification": null,
                • "board": null,
                • "collections": [ ],
                • "documentCategory": null,
                • "sourceDocument": null
                },
              • "extractedQnA": {
                • "heading": null,
                • "question": null,
                • "questionResult": null
                },
              • "app": {
                • "datasource": null,
                • "docType": null,
                • "mimeType": null,
                • "iconUrl": null
                },
              • "collection": {
                • "name": null,
                • "description": null,
                • "addedRoles": [ ],
                • "removedRoles": [ ],
                • "audienceFilters": [ ],
                • "icon": null,
                • "adminLocked": null,
                • "parentId": null,
                • "thumbnail": null,
                • "allowedDatasource": null,
                • "permissions": null,
                • "id": null,
                • "createTime": null,
                • "updateTime": null,
                • "creator": null,
                • "updatedBy": null,
                • "itemCount": null,
                • "childCount": null,
                • "items": [ ],
                • "pinMetadata": null,
                • "shortcuts": [ ],
                • "children": [ ],
                • "roles": [ ]
                },
              • "answerBoard": {
                • "name": null,
                • "description": null,
                • "addedRoles": [ ],
                • "removedRoles": [ ],
                • "audienceFilters": [ ],
                • "permissions": null,
                • "id": null,
                • "createTime": null,
                • "updateTime": null,
                • "creator": null,
                • "updatedBy": null,
                • "itemCount": null,
                • "roles": [ ]
                },
              • "code": {
                • "repoName": "scio",
                • "fileName": "README.md",
                • "matches": [
                  • {
                    • "lineNumber": 1,
                    • "content": "Welcome to the beginning",
                    • "ranges": [ ]
                    },
                  • {
                    • "lineNumber": 2,
                    • "content": "Second line of the file",
                    • "ranges": [ ]
                    },
                  • {
                    • "lineNumber": 3,
                    • "content": "hello world hello world",
                    • "ranges": [
                      • {
                        • "startindex": 0,
                        • "endIndex": 5
                        },
                      • {
                        • "startIndex": 12,
                        • "endIndex": 17
                        }
                      ]
                    }
                  ]
                },
              • "shortcut": {
                • "id": null,
                • "inputAlias": null,
                • "destinationUrl": null,
                • "destinationDocumentId": null,
                • "description": null,
                • "unlisted": null,
                • "urlTemplate": null,
                • "addedRoles": [ ],
                • "removedRoles": [ ],
                • "permissions": null,
                • "createdBy": null,
                • "createTime": null,
                • "updatedBy": null,
                • "updateTime": null,
                • "destinationDocument": null,
                • "intermediateUrl": null,
                • "viewPrefix": null,
                • "isExternal": null,
                • "editUrl": null,
                • "alias": null,
                • "title": null,
                • "roles": [ ]
                },
              • "querySuggestions": {
                • "suggestions": [ ],
                • "person": null
                },
              • "relatedDocuments": [
                • null
                ],
              • "relatedQuestion": {
                • "question": null,
                • "answer": null,
                • "ranges": [ ]
                },
              • "snippets": [
                • null
                ],
              • "trackingToken": "string",
              • "prominence": "HERO",
              • "source": "EXPERT_DETECTION"
              }
            ],
          • "trackingToken": "string",
          • "text": "string",
          • "querySuggestion": {
            • "query": "app:github type:pull author:mortimer",
            • "label": "Mortimer's PRs",
            • "datasource": "github"
            },
          • "writeAction": {
            • "toolName": "string",
            • "toolConfig": {
              • "displayName": "string",
              • "objectName": [
                • "HR ticket",
                • "Email",
                • "Chat message"
                ],
              • "logoUrl": "string",
              • "type": "REDIRECT"
              },
            • "redirectUrl": "string",
            • "parameters": {
              • "property1": {
                • "type": null,
                • "displayName": null,
                • "value": null,
                • "label": null,
                • "isRequired": null,
                • "description": null,
                • "possibleValues": [ ]
                },
              • "property2": {
                • "type": null,
                • "displayName": null,
                • "value": null,
                • "label": null,
                • "isRequired": null,
                • "description": null,
                • "possibleValues": [ ]
                }
              }
            },
          • "file": {
            • "id": "FILE_1234",
            • "name": "sample.pdf",
            • "metadata": {
              • "status": "PROCESSING",
              • "uploadTime": 0,
              • "processedSize": 0,
              • "failureReason": "PARSE_FAILED"
              }
            }
          }
        ],
      • "metadata": "string",
      • "ts": "string",
      • "messageId": "string",
      • "messageTrackingToken": "string",
      • "messageType": "UPDATE",
      • "hasMoreFragments": true
      }
    ],
  • "chatId": "string",
  • "followUpPrompts": [
    • "string"
    ],
  • "backendTimeMillis": 1100,
  • "chatSessionTrackingToken": "string"
}