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
POST /sessions/{session_id}/archive
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-max"},
"system": "你是数据分析专家,使用 pandas 处理 CSV 文件。",
"tools": []
},
"environment_id": "env_xxx",
"title": "Q3 销售数据分析",
"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"
}
The response is a Session object with the following fields:
Response fields
|
Field |
Type |
Description |
|
|
string |
Session ID |
|
|
string |
Always |
|
|
string |
Set to |
|
|
object |
Agent configuration snapshot |
|
|
string |
The bound environment ID |
|
|
string / object |
Session title and business metadata |
|
|
string |
Archive time, ISO 8601; this field is always non-null in responses from the archive endpoint |
|
|
string |
Creation/last update time |
|
|
string |
Unique identifier for this request |