Skip to main content
Perplexity

Search documentation

Type to search this documentation.

Cancel Agent Response

POST/v1/agent/{id}/cancelCancel Agent Response

Requests cancellation of response {id}. Acts on durable state, so it works for background runs that outlive the client connection. Cancellation is asynchronous: a 200 acknowledges the request (status: cancelling) and the run stops shortly after - poll GET /v1/agent/{id} for its terminal status. Cancelling a run that is already terminal returns 400. Ownership is enforced server side; a cross-tenant or unknown id surfaces as 404.

Parameters

idstringpathrequired

Response id (`resp_<...>`)

Responses

200The cancel request was accepted; the run is being cancelled.application/json
object
response_idstringrequired

The response id (`resp_<...>`).

statusstringrequired

Always `cancelling` - the cancel was accepted and the run stops asynchronously. An already-terminal run returns `400` instead, so no terminal status appears here.

one of "cancelling"

Example response
{
  "response_id": "string",
  "status": "cancelling"
}
400The response is already terminal, or the request is invalid.application/json
object
errorobject

Error information returned when a request fails

Show child attributes
codestring

Error code

messagestringrequired

Human-readable error message

typestring

Error type category

Example response
{
  "error": {
    "code": "string",
    "message": "string",
    "type": "string"
  }
}
404Unknown id, or the response belongs to a different account.application/json
object
errorobjectErrorInfo ↑

Error information returned when a request fails

Example response
{
  "error": {
    "code": "string",
    "message": "string",
    "type": "string"
  }
}
Documentation menu