curl --request POST \
  --url https://{domain}-be.glean.com/rest/api/v1/chat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "author": "USER",
      "messageType": "CONTENT",
      "fragments": [
        {
          "text": "What are the company holidays this year?"
        }
      ]
    }
  ]
}'
{
  "messages": [
    {
      "author": "GLEAN_AI",
      "messageType": "CONTENT",
      "hasMoreFragments": false,
      "agentConfig": {
        "agent": "DEFAULT",
        "mode": "DEFAULT"
      },
      "fragments": [
        {
          "text": "There are no holidays!"
        }
      ]
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-Scio-Actas
string

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

X-Glean-Auth-Type
string

Auth type being used to access the endpoint (should be non-empty only for global tokens).

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.

Body

application/json
Includes chat history for Glean AI to respond to.
messages
object[]
required

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.

A message that is rendered as one coherent unit with one given sender.

saveChat
boolean

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

chatId
string

The id of the Chat that context should be retrieved from and messages added to. An empty id starts a new Chat, and the Chat is saved if saveChat is true.

agentConfig
object

Describes the agent that will execute the request.

inclusions
object

A list of filters which only allows chat to access certain content.

exclusions
object

A list of filters which disallows chat from accessing certain content. If content is in both inclusions and exclusions, it'll be excluded.

timeoutMillis
integer

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

Example:

30000

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.

stream
boolean

If set, response lines will be streamed one-by-one as they become available. Each will be a ChatResponse, formatted as JSON, and separated by a new line. If false, the entire response will be returned at once. Note that if this is set 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 be.

Response

200
text/plain
OK

A single response from the /chat backend.

messages
object[]

A message that is rendered as one coherent unit with one given sender.

chatId
string

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

followUpPrompts
string[]

Follow-up prompts for the user to potentially use

backendTimeMillis
integer

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

Example:

1100

chatSessionTrackingToken
string

A token that is used to track the session.