Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview

Get prompt-ready session context

Return the rolling summary and newest message tail that fits the token budget.

GET/api/v2/sessions/{id}/context
Authorization
AuthorizationBearer token (Anlyon API key) · headerrequired

Workspace API key sent as Authorization: Bearer <key>.

or
better-auth.session_tokenAPI key · cookierequired

Browser session used by dashboard-only operations.

Path parameters
idstringrequired

Public session identifier.

min length 1 · max length 100
Query parameters
maxTokensinteger
min 100 · max 128000 · default: 2000
runIdstring

Existing run in this API key environment for the session-read span.

max length 80
parentSpanIdstring

Optional parent span within runId.

max length 80
Header parameters
X-Request-Idstring

Optional caller correlation ID. Unsafe or oversized values are replaced.

max length 128
Responses
200

Prompt-ready session context returned.

successbooleanrequired
Allowed:true
dataSessionContextrequired
Show properties
sessionIdstringrequired
summarystring | nullrequired
messagesSessionMessage[]required
Show properties
Array of SessionMessage
indexintegerrequired
min 0
rolestringrequired
Allowed:systemuserassistanttool
contentstringrequired
toolCallIdstring | nullrequired
tokenCountintegerrequired
min 0
metadataobjectrequired
createdAtstring<date-time>required
tokensUsedintegerrequired
min 0
truncatedbooleanrequired
400

Bad Request - Invalid input data

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
401

Unauthorized - Invalid or missing API key

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
403

Authenticated credential lacks the required scope or workspace access.

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
404

Not Found - Resource does not exist

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
429

Too Many Requests - Rate limit exceeded

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
Try it
Server
Authorization
Parameters
Request
curl -X GET 'https://api.anlyon.com/api/v2/sessions/string/context' \
  -H 'Authorization: Bearer YOUR_TOKEN'
Response
{
  "success": true,
  "data": {
    "sessionId": "string",
    "summary": "string",
    "messages": [
      {
        "index": 0,
        "role": "system",
        "content": "string",
        "toolCallId": "string",
        "tokenCount": 0,
        "metadata": {},
        "createdAt": "2019-08-24T14:15:22Z"
      }
    ],
    "tokensUsed": 0,
    "truncated": true
  }
}