---
title: "Create a chat response"
method: POST
path: "/api/chat"
tags: ["Chat"]
---

# Create a chat response

`POST /api/chat`

Run an assistant turn. Set `stream` to true to receive server-sent events; otherwise the response is a typed JSON response object.

## Request body

- PlatformChatCreateRequest
  - `input` union, required — Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
    - string
    - PlatformChatInputMessage[]
      - `role` 'USER' | 'ASSISTANT', required
      - `content` string, required
  - `stream` boolean — When true, respond with `text/event-stream`. When false or omitted, respond with `application/json`.
  - `store` boolean — When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
  - `conversation_id` string — Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.

## Response `200`

Successful response.

- PlatformChatCompletedResponse
  - `id` string, required — Platform-owned, non-persisted response envelope identifier in `resp_<uuid>` form. The same identifier is used for every event in one streamed response.
  - `object` 'RESPONSE', required
  - `created_at` string, date-time, required — RFC 3339 UTC timestamp when the response was created.
  - `status` 'COMPLETED', required
  - `output` PlatformChatOutputMessage[], required
    - `type` 'MESSAGE', required
    - `role` 'ASSISTANT', required
    - `content` PlatformChatOutputTextContent[], required
      - `type` 'OUTPUT_TEXT', required
      - `text` string, required
      - `annotations` PlatformChatCitationAnnotation[]
        - `type` 'CITATION', required
        - `sources` PlatformChatCitationSource[], required
          - union — Four-variant citation source union.
            - union
              - …
            - PlatformChatPersonSource
              - …
            - PlatformChatFileSource
              - …
            - PlatformChatCustomEntitySource
              - …
        - `start_index` integer, nullable
        - `end_index` integer, nullable
        - `snippets` PlatformChatCitationSnippet[], nullable
          - `text` string, required
          - `page_number` integer, nullable
  - `store` boolean, required
  - `conversation_id` string, nullable — Present when the interaction was persisted.
  - `request_id` string, required

## Other responses

- `400` — Invalid request (malformed JSON, invalid parameter values, unknown fields).
- `401` — Missing or invalid authentication token.
- `403` — Token valid but lacks permission for the requested operation.
- `404` — Resource not found.
- `408` — Backend did not respond within the timeout window.
- `413` — Request body exceeds the maximum allowed size.
- `422` — Syntactically valid but semantically incorrect request.
- `429` — Rate limit exceeded. Includes Retry-After header.
- `500` — Unexpected server-side failure.
- `503` — Backend temporarily unavailable.

## Changes

- **2026-08-20** `ff232857e88b` — 4 info
  - mapped value for discriminator key `CUSTOM_ENTITY` changed from `#/components/schemas/ChatCustomEntitySource` to `#/components/schemas/PlatformChatCustomEntitySource` for `output/items/content/items/annotations/items/sources/items/` response property for the response status `200`
  - mapped value for discriminator key `DOCUMENT` changed from `#/components/schemas/ChatDocumentSource` to `#/components/schemas/PlatformChatDocumentSource` for `output/items/content/items/annotations/items/sources/items/` response property for the response status `200`
  - mapped value for discriminator key `FILE` changed from `#/components/schemas/ChatFileSource` to `#/components/schemas/PlatformChatFileSource` for `output/items/content/items/annotations/items/sources/items/` response property for the response status `200`
  - mapped value for discriminator key `PERSON` changed from `#/components/schemas/ChatPersonSource` to `#/components/schemas/PlatformChatPersonSource` for `output/items/content/items/annotations/items/sources/items/` response property for the response status `200`
- …earlier changes not shown

[Full history](https://skmtc.dev/gleanwork/apis/glean-platform-api/changes/api/chat/post.md)

---

[API](https://skmtc.dev/gleanwork/apis/glean-platform-api.md) · [All operations](https://skmtc.dev/gleanwork/apis/glean-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gleanwork/glean-platform-api/revisions/46c121f70527/schema)
