Skip to main content

List turn items

List items for a specific root agent turn to verify messages, tool calls, and reasoning summaries.

Endpoint

GET /agents/sessions/{session_id}/turns/{turn_id}/items Returns items for a specific root agent turn. Returns 200 on success. The query does not start a model, resume execution, or create resources.

Path parameters

FieldRequiredTypeDescription
session_idYesstringSession ID, for example sess_xxx
turn_idYesstringPublic turn ID, for example turn_xxx
The path hierarchy must match. If the turn does not belong to the session, no data is returned.

Request parameters

FieldRequiredTypeDescription
limitNointegerPage size, range 1–100, default 20
orderNostringSort direction, asc or desc, default desc
afterNostringThe last_id from the previous page; the cursor item is excluded
before is ignored and is not used for reverse pagination. Use order and after to page.

Request example

curl --get "$BASE_URL/agents/sessions/sess_xxx/turns/turn_xxx/items" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --data-urlencode "limit=20" \
  --data-urlencode "order=asc"

Response example

{
  "object": "list",
  "data": [
    {
      "id": "msg_xxx",
      "turn_id": "turn_xxx",
      "type": "message",
      "status": "completed",
      "role": "assistant",
      "phase": "final_answer",
      "content": [{"type": "output_text", "text": "Done"}]
    }
  ],
  "first_id": "msg_xxx",
  "last_id": "msg_xxx",
  "has_more": false
}
{
  "object": "list",
  "data": [],
  "first_id": null,
  "last_id": null,
  "has_more": false
}

Response fields

List envelope:
FieldTypeDescription
objectstringList object type, fixed as list
dataarray<Item>Items on this page; [] when empty
first_idstring / nullFirst item ID on this page; null for an empty page
last_idstring / nullLast item ID on this page; null for an empty page; use it as after
has_morebooleanWhether the current scan direction has another page
Every item has id, turn_id, and type. Business fields are at the top level. For item types and content parts, see List Items. Persisted items use final content. SSE item.added can show an in-progress item; an unfinished real-time item is not guaranteed to appear in the list.

Error codes

HTTP statusError type / codeSolution
400invalid_request_error / invalid_request_errorFix limit and order as described in the query parameters; use the last_id returned by the previous page as after
404not_found_error / not_found_errorConfirm that the session and turn exist in the same workspace, and use matching path levels
502server_error / agents_api_upstream_unavailableRetry later. If it keeps failing, submit a ticket with the x-request-id from the response headers