Retrieve a message.

GET /threads/{thread_id}/messages/{message_id}

Path parameters

  • thread_id string Required

    The ID of the thread to which this message belongs.

  • message_id string Required

    The ID of the message to retrieve.

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id string Required

      The identifier, which can be referenced in API endpoints.

    • object string Required

      The object type, which is always thread.message.

      Value is thread.message.

    • created_at integer Required

      The Unix timestamp (in seconds) for when the message was created.

    • thread_id string Required

      The thread ID that this message belongs to.

    • status string Required

      The status of the message, which can be either in_progress, incomplete, or completed.

      Values are in_progress, incomplete, or completed.

    • incomplete_details object | null Required

      On an incomplete message, details about why the message is incomplete.

      Hide incomplete_details attribute Show incomplete_details attribute object | null
      • reason string Required

        The reason the message is incomplete.

        Values are content_filter, max_tokens, run_cancelled, run_expired, or run_failed.

    • completed_at integer | null Required

      The Unix timestamp (in seconds) for when the message was completed.

    • incomplete_at integer | null Required

      The Unix timestamp (in seconds) for when the message was marked as incomplete.

    • role string Required

      The entity that produced the message. One of user or assistant.

      Values are user or assistant.

    • content array[object] Required

      The content of the message in array of text and/or images.

      One of:

      References an image File in the content of a message.

      Hide attributes Show attributes
      • type string Required

        Always image_file.

        Value is image_file.

      • image_file object Required
        Hide image_file attributes Show image_file attributes object
        • file_id string Required

          The File ID of the image in the message content. Set purpose="vision" when uploading the File if you need to later display the file content.

        • detail string

          Specifies the detail level of the image if specified by the user. low uses fewer tokens, you can opt in to high resolution using high.

          Values are auto, low, or high. Default value is auto.

    • assistant_id string | null Required

      If applicable, the ID of the assistant that authored this message.

    • run_id string | null Required

      The ID of the run associated with the creation of this message. Value is null when messages are created manually using the create message or create thread endpoints.

    • attachments array[object] | null Required

      A list of files attached to the message, and the tools they were added to.

      Hide attachments attributes Show attachments attributes object
      • file_id string

        The ID of the file to attach to the message.

      • tools array[object]

        The tools to add this file to.

        One of:
        Hide attribute Show attribute
        • type string Required

          The type of tool being defined: code_interpreter

          Value is code_interpreter.

    • metadata object | null Required

      Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

      Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

      Hide metadata attribute Show metadata attribute object | null
      • * string Additional properties
GET /threads/{thread_id}/messages/{message_id}
curl \
 --request GET 'https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "id": "string",
  "object": "thread.message",
  "created_at": 42,
  "thread_id": "string",
  "status": "in_progress",
  "incomplete_details": {
    "reason": "content_filter"
  },
  "completed_at": 42,
  "incomplete_at": 42,
  "role": "user",
  "content": [
    {
      "type": "image_file",
      "image_file": {
        "file_id": "string",
        "detail": "auto"
      }
    }
  ],
  "assistant_id": "string",
  "run_id": "string",
  "attachments": [
    {
      "file_id": "string",
      "tools": [
        {
          "type": "code_interpreter"
        }
      ]
    }
  ],
  "metadata": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  }
}