Cancel a response

POST
/v1/responses/{response_id}/cancel

Stop a response. A dropped stream cancels nothing; this call does.

The response comes back cancelled once nothing was left running, or in_progress while a step is still being torn down; a second cancel then also answers 200. A response that has already finished is response_finished, which includes one whose answer was complete when the cancel arrived: that one completes and is charged.

A response cancelled before its first text delta reached you is free; one cancelled after it is charged. The call accepts Idempotency-Key and stores nothing.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Path Parameters

response_id*string

The id of a response of this key.

Formatuuid

Header Parameters

Idempotency-Key?string

Makes a retry safe. A repeat of the same request answers with the stored result and Idempotent-Replayed: true, and is never charged again; the same key on a different request is idempotency_key_reused. Without it, a retry is a new, charged request.

Match^[ -~]+$
Length1 <= length <= 255

Response Body

The response after the cancel.

application/json
  1. response

A response, in OpenAI's Responses shape plus depth, sources and usage.cost.

Fields OpenAI defines and this API does not use keep their defaults.

completed_at*|

Unix seconds at which the response ended, whatever its status.

created_at*integer

Unix seconds.

depth*|

Echoed from the request; null for a response made before depth existed.

error*|null
id*string
Formatuuid
incomplete_details*|null
instructions*string|null
metadata*
model*string

The label the request named, echoed.

object*string
output*array<>

Empty until the response is completed: there is no partial text.

parallel_tool_calls*boolean
previous_response_id*string|null
reasoning*
sources*array<>

What the answer cites, numbered by first citation. Empty until the response is completed.

status*string
Value in"queued""in_progress""completed""failed""cancelled"
store*boolean
temperature*number
text*
tool_choice*string
tools*array<>
top_p*number
truncation*string
Value in"auto""disabled"
usage*|

Present once the response has ended.

Example Request
curl -X POST 'https://api.azta.ai/v1/responses/497f6eca-6276-4993-bfeb-53cbbbba6f08/cancel'
Example Response
{  "completed_at": 0,  "created_at": 0,  "depth": "standard",  "error": {    "code": "server_error",    "message": "string"  },  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "incomplete_details": {    "property1": "string",    "property2": "string"  },  "instructions": "string",  "metadata": {    "property1": "string",    "property2": "string"  },  "model": "string",  "object": "response",  "output": [    {      "content": [        {          "annotations": [            {              "end_index": 0,              "source_number": 1,              "start_index": 0,              "title": "string",              "type": "url_citation",              "url": "string"            }          ],          "text": "string",          "type": "output_text"        }      ],      "id": "string",      "role": "assistant",      "status": "completed",      "type": "message"    }  ],  "parallel_tool_calls": true,  "previous_response_id": "string",  "reasoning": {    "effort": "string",    "summary": "string"  },  "sources": [    {      "act": {        "identifier": "string",        "short_title": "string",        "title": "string"      },      "country": "string",      "excerpt": "string",      "kind": "provision",      "number": 1,      "section": "string",      "title": "string",      "unit_id": "string",      "url": "http://example.com",      "url_kind": "official",      "version": {        "effective_from": "2019-08-24",        "effective_to": "2019-08-24",        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "is_current": true      }    }  ],  "status": "queued",  "store": true,  "temperature": 0,  "text": {    "format": {      "type": "text"    }  },  "tool_choice": "string",  "tools": [    {}  ],  "top_p": 0,  "truncation": "auto",  "usage": {    "cost": {      "amount": "string",      "currency": "EUR"    },    "input_tokens": 0,    "input_tokens_details": {      "cached_tokens": 0    },    "output_tokens": 0,    "output_tokens_details": {      "reasoning_tokens": 0    },    "total_tokens": 0  }}