List Messages

Supported Providers
  • OpenAI

Returns a list of messages for a given thread.

get
Authorizations
Path parameters
thread_idstringRequired

The ID of the thread the messages belong to.

Query parameters
limitintegerOptional

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

Default: 20
orderstring · enumOptional

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

Default: descPossible values:
afterstringOptional

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

beforestringOptional

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

run_idstringOptional

Filter messages by the run ID that generated them.

Responses
200
OK
application/json
get
curl https://api.portkey.ai/v1/threads/thread_abc123/messages \
  -H "Content-Type: application/json" \
  -H "x-portkey-api-key: $PORTKEY_API_KEY" \
  -H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
  -H "OpenAI-Beta: assistants=v2"
200

OK

{
  "object": "list",
  "data": [
    {
      "id": "text",
      "object": "thread.message",
      "created_at": 1,
      "thread_id": "text",
      "status": "in_progress",
      "incomplete_details": {
        "reason": "content_filter"
      },
      "completed_at": 1,
      "incomplete_at": 1,
      "role": "user",
      "content": [
        {
          "type": "image_file",
          "image_file": {
            "file_id": "text",
            "detail": "auto"
          }
        }
      ],
      "assistant_id": "text",
      "run_id": "text",
      "attachments": [
        {
          "file_id": "text",
          "tools": [
            {
              "type": "code_interpreter"
            }
          ]
        }
      ],
      "metadata": {}
    }
  ],
  "first_id": "msg_abc123",
  "last_id": "msg_abc123",
  "has_more": false
}

Last updated

Was this helpful?