Retrieve run step

GET /threads/{thread_id}/runs/{run_id}/steps/{step_id}

Retrieves a run step.

Path parameters

  • thread_id string Required

    The ID of the thread to which the run and run step belongs.

  • run_id string Required

    The ID of the run to which the run step belongs.

  • step_id string Required

    The ID of the run step to retrieve.

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id string Required

      The identifier of the run step, which can be referenced in API endpoints.

    • object string Required

      The object type, which is always thread.run.step.

      Value is thread.run.step.

    • created_at integer Required

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

    • assistant_id string Required

      The ID of the assistant associated with the run step.

    • thread_id string Required

      The ID of the thread that was run.

    • run_id string Required

      The ID of the run that this run step is a part of.

    • type string Required

      The type of run step, which can be either message_creation or tool_calls.

      Values are message_creation or tool_calls.

    • status string Required

      The status of the run step, which can be either in_progress, cancelled, failed, completed, or expired.

      Values are in_progress, cancelled, failed, completed, or expired.

    • step_details object Required

      One of:
    • last_error object | null Required

      The last error associated with this run step. Will be null if there are no errors.

      Hide last_error attributes Show last_error attributes object | null
      • code string Required

        One of server_error or rate_limit_exceeded.

        Values are server_error or rate_limit_exceeded.

      • message string Required

        A human-readable description of the error.

    • expired_at integer | null Required

      The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.

    • cancelled_at integer | null Required

      The Unix timestamp (in seconds) for when the run step was cancelled.

    • failed_at integer | null Required

      The Unix timestamp (in seconds) for when the run step failed.

    • completed_at integer | null Required

      The Unix timestamp (in seconds) for when the run step completed.

    • 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. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.

    • usage object | null Required

      Usage statistics related to the run step. This value will be null while the run step's status is in_progress.

      Hide usage attributes Show usage attributes object | null
      • completion_tokens integer Required

        Number of completion tokens used over the course of the run step.

      • prompt_tokens integer Required

        Number of prompt tokens used over the course of the run step.

      • total_tokens integer Required

        Total number of tokens used (prompt + completion).

GET /threads/{thread_id}/runs/{run_id}/steps/{step_id}
curl \
 -X GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/steps/{step_id} \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "id": "string",
  "object": "thread.run.step",
  "created_at": 42,
  "assistant_id": "string",
  "thread_id": "string",
  "run_id": "string",
  "type": "message_creation",
  "status": "in_progress",
  "step_details": {
    "type": "message_creation",
    "message_creation": {
      "message_id": "string"
    }
  },
  "last_error": {
    "code": "server_error",
    "message": "string"
  },
  "expired_at": 42,
  "cancelled_at": 42,
  "failed_at": 42,
  "completed_at": 42,
  "metadata": {},
  "usage": {
    "completion_tokens": 42,
    "prompt_tokens": 42,
    "total_tokens": 42
  }
}