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_idstringRequired

Session that owns the artifact

artifact_idstringRequired

Artifact 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

idstring

Artifact version ID, not a file_id

objectstring

Artifact object type, fixed as agent.session.artifact

session_idstring

Owning session

environment_idstring

Source environment

turn_idstring

Source turn

pathstring

Full sandbox path when the artifact was generated

size_bytesinteger

File size in bytes

created_atinteger

Creation 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 statusError type / codeSolution
404not_found_error / not_found_errorUse 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.