Retrieve an artifact
Updated at:
Retrieve metadata for a single immutable artifact version.
Endpoint
Returns metadata for the specified artifact. A successful call returns 200 and does not return file content.
GET
/agents/sessions/{session_id}/artifacts/{artifact_id}Path parameters
session_idstringRequiredSession that owns the artifact
artifact_idstringRequiredArtifact version ID from the list response, not a file_id or snapshot ID
No request body.
Request example
curl -sS "$BASE_URL/agents/sessions/sess_xxx/artifacts/artifact_xxx" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "OpenAI-Beta: agents=v1"
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DASHSCOPE_API_KEY"],
base_url=os.environ["BASE_URL"],
)
artifact = client.beta.agents.sessions.artifacts.retrieve(
"artifact_xxx",
session_id="sess_xxx",
)
print(artifact.id, artifact.path, artifact.size_bytes)
Response fields
idstringArtifact version ID, not a file_id
objectstringArtifact object type, fixed as agent.session.artifact
session_idstringOwning session
environment_idstringSource environment
turn_idstringSource turn
pathstringFull sandbox path when the artifact was generated
size_bytesintegerFile size in bytes
created_atintegerCreation time, Unix seconds
The detail response does not return underlying storage identifiers, signed download URLs, or credentials.
Response example
{
"id": "artifact_xxx",
"object": "agent.session.artifact",
"session_id": "sess_xxx",
"environment_id": "ccarenv_xxx",
"turn_id": "turn_xxx",
"path": "/workspace/outputs/report.txt",
"size_bytes": 19,
"created_at": 1793941200
}
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
404 | not_found_error / not_found_error | Use an artifact ID that exists and has not been deleted in the current workspace |
The error body has the shape {"error":{"type","code","message","param"}}. Gateway errors can use a different structure.
Is this page helpful?