Skip to main content
POST
Back to the Analytics APIs overview Use this endpoint to generate a model-written summary of one conversation. Summarize a saved session with sessionId, or send a transcript in messages. Send exactly one of the two. The endpoint doesn’t store the summary. For a saved session, set includeMessages to true to also get the first page of the conversation history. The history has the same format as List conversation messages.

Prerequisites

  • A Platform Key bound to the project, sent in the x-api-key header, with the analytics:read permission.
  • A model bound to the conversation_summary feature in the project. Without it, the API returns 422 SUMMARY_MODEL_NOT_CONFIGURED.
  • For a saved session, the ID of a session in the project.

Request

Send a JSON body. Set Content-Type to application/json or application/jose+json. When request encryption is on for the Platform Key, send the body as an encrypted JWE. For details, see List conversation messages using JWE payload. In session mode, the summary covers at most the 2,000 newest user and assistant messages of the session.

Include conversation history

With includeMessages, the response contains messages, hasMore, and nextCursor. They have the same format as the response of List conversation messages. The response holds only the first page. To get the rest, call List conversation messages with sessionIds set to the session ID and cursor set to nextCursor.

Response

How the summary is generated

  • Only user and assistant messages reach the model.
  • The prompt is the project’s llm_prompt.conversation_summary override, or the platform default when there is no override. A deployed session uses the settings version it ran with.
  • The model is the one bound to the project’s conversation_summary feature.
  • In transcript mode, the project’s input PII redaction applies to user messages.
  • The summary passes through the project’s PII read policy, as the content of List conversation messages does.
  • The endpoint stores nothing.

Errors

An error response has success set to false and an error object with a code and a message.

Authorizations

x-api-key
string
header
required

Path Parameters

projectId
string
required
Minimum string length: 1

Body

sessionId
string

Session ID in this project. Send this or messages, not both.

Minimum string length: 1
messages
object[]

Transcript to summarize. Send this or sessionId, not both. Content is limited to 100,000 characters in total.

Required array length: 1 - 500 elements
includeMessages
boolean
default:false

Session mode only. Also return the first page of conversation history.

Response

Summary generated, or history returned with an unavailable summary.

success
boolean
required
summary
string | null
required

The summary after the PII read policy. Null only when summaryStatus is unavailable.

summaryStatus
enum<string>
required

unavailable only when the model failed and includeMessages was true.

Available options:
generated,
unavailable
sessionId
string | null
required

Canonical session ID. Null in transcript mode.

messageCount
integer
required

User and assistant messages available (at most 2,000 newest for a session).

summarizedMessageCount
integer
required

Messages sent to the model.

truncated
boolean
required

True when older messages were left out to fit the input budget.

requestId
string
required

Matches the llm_metrics callId and support logs.

summaryError
object
messages
object[]

With includeMessages. Same items as the conversation-history API.

hasMore
boolean

With includeMessages. More history exists after this page.

nextCursor
string | null

With includeMessages. Pass to /conversation-history as cursor.