Archive Session
Archives a session: sets status to the terminal state terminated, populates archived_at with the archive time, and event history remains queryable.
Prerequisites
Endpoint and authentication configured. For details, see Overview and authentication.
Endpoint
/sessions/{session_id}/archivePath parameters
session_idstringRequiredSession ID, format sesn_<ULID>
Response fields
The response is a Session object with the following fields:
idstringSession ID
typestringAlways session
statusstringSet to terminated (terminal state) after archiving
agentobjectAgent configuration snapshot
agent properties
idstringAgent ID, format agent_xxx
versionintegerVersion to pin; latest if omitted
environment_idstringThe bound environment ID
titlestringSession title
metadataobjectCustom business key-value pairs
archived_atstringArchive time, ISO 8601; this field is always non-null in responses from the archive endpoint
created_atstringCreation time
updated_atstringLast update time
request_idstringUnique identifier for this request
Request example
curl -X POST "$AGENTSTUDIO_URL/sessions/sesn_xxx/archive" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"
client.sessions.archive("sesn_xxx")
client.sessions().archive("sesn_xxx");
Response example
Returns the full session object with status set to terminated and archived_at populated with the archive time.
{
"id": "sesn_xxx",
"type": "session",
"status": "terminated",
"agent": {
"id": "agent_xxx",
"type": "agent",
"version": 1,
"name": "data-analyst",
"model": {"id": "qwen3.7-max"},
"system": "You are a data analysis expert who uses pandas to process CSV files.",
"tools": []
},
"environment_id": "env_xxx",
"title": "Q3 sales data analysis",
"metadata": {"biz_ticket_id": "1234"},
"archived_at": "2026-05-28T11:00:00Z",
"created_at": "2026-05-28T08:23:11Z",
"updated_at": "2026-05-28T11:00:00Z",
"request_id": "xxx"
}