Cancel agent run
curl --request POST \
--url https://api.entendre.finance/v1/agents/{agent_id}/runs/{run_id}/cancel \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-API-Key: <api-key>' \
--data '
{
"reason": "Correct the selected accounting records."
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({reason: 'Correct the selected accounting records.'})
};
fetch('https://api.entendre.finance/v1/agents/{agent_id}/runs/{run_id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.entendre.finance/v1/agents/{agent_id}/runs/{run_id}/cancel"
payload = { "reason": "Correct the selected accounting records." }
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "run_xyz789",
"status": "in_progress",
"success_data": null,
"error_data": null,
"error_message": null,
"reviewed_by": null,
"reviewed_at": null,
"created_at": "2026-08-31T12:00:00Z",
"updated_at": "2026-08-31T12:00:00Z",
"agent_id": "agt_507f1f77bcf86cd799439011",
"review": {
"status": "not_required",
"reviewer_user_id": null,
"review_url": null,
"reviewed_at": null
},
"result_links": [],
"status_url": "/v1/agents/agt_507f1f77bcf86cd799439011/runs?run_ids=run_xyz789"
},
"meta": {
"cancellation_status": "accepted"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid path, query or request body.",
"request_id": "req_example"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired API Key",
"request_id": "req_example",
"suggested_action": "Send an API key in X-API-Key, or an OAuth access token as Authorization: Bearer. Refresh an expired access token.",
"documentation_url": "https://entendre.ai/docs/get-started/authentication"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Insufficient access to organization",
"request_id": "req_example"
}
}{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Resource not found",
"request_id": "req_example"
}
}{
"error": {
"code": "CONFLICT",
"message": "The resource state does not allow this operation.",
"request_id": "req_example"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 30s.",
"request_id": "req_example"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal server error",
"request_id": "req_example"
}
}{
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "Service unavailable.",
"request_id": "req_example"
}
}Agents
Cancel agent run
Requests that an agent run stop.
POST
/
v1
/
agents
/
{agent_id}
/
runs
/
{run_id}
/
cancel
Cancel agent run
curl --request POST \
--url https://api.entendre.finance/v1/agents/{agent_id}/runs/{run_id}/cancel \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-API-Key: <api-key>' \
--data '
{
"reason": "Correct the selected accounting records."
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({reason: 'Correct the selected accounting records.'})
};
fetch('https://api.entendre.finance/v1/agents/{agent_id}/runs/{run_id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.entendre.finance/v1/agents/{agent_id}/runs/{run_id}/cancel"
payload = { "reason": "Correct the selected accounting records." }
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "run_xyz789",
"status": "in_progress",
"success_data": null,
"error_data": null,
"error_message": null,
"reviewed_by": null,
"reviewed_at": null,
"created_at": "2026-08-31T12:00:00Z",
"updated_at": "2026-08-31T12:00:00Z",
"agent_id": "agt_507f1f77bcf86cd799439011",
"review": {
"status": "not_required",
"reviewer_user_id": null,
"review_url": null,
"reviewed_at": null
},
"result_links": [],
"status_url": "/v1/agents/agt_507f1f77bcf86cd799439011/runs?run_ids=run_xyz789"
},
"meta": {
"cancellation_status": "accepted"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid path, query or request body.",
"request_id": "req_example"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired API Key",
"request_id": "req_example",
"suggested_action": "Send an API key in X-API-Key, or an OAuth access token as Authorization: Bearer. Refresh an expired access token.",
"documentation_url": "https://entendre.ai/docs/get-started/authentication"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Insufficient access to organization",
"request_id": "req_example"
}
}{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Resource not found",
"request_id": "req_example"
}
}{
"error": {
"code": "CONFLICT",
"message": "The resource state does not allow this operation.",
"request_id": "req_example"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 30s.",
"request_id": "req_example"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal server error",
"request_id": "req_example"
}
}{
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "Service unavailable.",
"request_id": "req_example"
}
}meta.cancellation_status shows the result:
| Status | Meaning | Next step |
|---|---|---|
accepted | The stop signal was accepted. | Poll status_url for the final run state. |
pending | The cancellation is not confirmed yet. | Check the run before you retry. |
no_active_turn, no_session | No running turn was stopped. | Check the saved run status. |
owner_mismatch | The owner of the run could not be verified. The run was not changed. | None. |
write:agents and an API key with an owner.Authorizations
Your organization API key. See Authentication.
Headers
Unique key for this operation. Retry with the same key and request body after a timeout. Keys are retained for at least 24 hours.
Required string length:
1 - 255Path Parameters
ID of the agent.
Minimum string length:
1ID of the run.
Minimum string length:
1Body
application/json
Reason included in the organization audit event.
Required string length:
1 - 500Example:
"Correct the selected accounting records."