Chat

post/chat

Have a conversation with Glean AI.

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-Glean-Auth-Type
string

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

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 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.

object (ChatRestrictionFilters)
object (ChatRestrictionFilters)
saveChat
boolean

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

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.

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: text/plain
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",
      • "messageType": "CONTENT",
      • "fragments": [
        • {
          • "text": "What are the company holidays this year?"
          }
        ]
      }
    ]
}
Response samples
text/plain
{
  "messages": [
    {
      "author": "GLEAN_AI",
      "messageType": "CONTENT",
      "hasMoreFragments": false,
      "agentConfig": {
        "agent": "DEFAULT",
        "mode": "DEFAULT"
      },
      "fragments": [
        {
          "text": "There are no holidays!"
        }
      ]
    }
  ]
}