Skip to main content

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"

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": "你是数据分析专家,使用 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

FieldTypeDescription
idstringSession ID
typestringAlways session
statusstringSet to terminated (terminal state) after archiving
agentobjectAgent configuration snapshot
environment_idstringThe bound environment ID
title / metadatastring / objectSession title and business metadata
archived_atstringArchive time, ISO 8601; this field is always non-null in responses from the archive endpoint
created_at / updated_atstringCreation/last update time
request_idstringUnique identifier for this request
Flow Agent API
Sandbox API
RAG API
Long-term Memory
ParseX API
Security API
Framework Integration