Agents

List agent sessions

Changed on

Lists managed agent sessions using ID-based pagination and the requested sort order. See managing sessions.

get/agents/sessions

Request

  • Base URL
    https://api.openai.com/v1
  • URL
    https://api.openai.com/v1/agents/sessions
  • Auth
    HTTP bearer

Query parameters

limitinteger

The maximum number of resources to return, between 1 and 100. Defaults to 20.

order'asc' | 'desc'

The order in which paginated resources are returned.

The order in which resources are returned. Defaults to desc.

afterstring

Return resources after this resource ID in the selected order.

agent_idstring

Only return sessions whose root agent has this ID. Omit to return sessions for all agents.

metadataobject

Exact string matches supplied as metadata[key]=value. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. New sessions and metadata updates may take time to appear in filtered results.

Response

A page of sessions.

object'list' required

The object type, which is always list.

first_idstring nullable required

The ID of the first resource in data, or null if the page is empty.

last_idstring nullable required

The ID of the last resource in data, or null if the page is empty. Pass this as after with the same order and filters.

has_moreboolean required

Whether there are more resources to retrieve after this page.

Changes