# Cancel response div strong 🔨 In Development — This section is still being developed and may change. Cancels an in-progress model response. Use this endpoint to stop a response that is currently being generated. Cancels a response that is currently being processed. Only responses with status `processing` can be cancelled. Once cancelled, the response status will change to `cancelled` and no further processing will occur. #### Path Parameters **`response_id`** string required The unique identifier of the response to cancel. Must be a response that is currently in `processing` status. #### Query Parameters **`organizationId`** string required The unique identifier of the organization that owns the response. #### Response **`id`** string The unique identifier of the cancelled response. **`status`** string The new status of the response. Will be `cancelled` after successful cancellation. **`cancelledAt`** integer Unix timestamp when the response was cancelled. **`message`** string Confirmation message indicating the response was cancelled. ## Returns A cancellation confirmation response. Cancel response ```bash curl -X DELETE "https://api.freddy.aitronos.com/v1/model/response/resp_abc123?organizationId=org_abc123" \ -H "Authorization: Bearer $FREDDY_API_KEY" ``` ```python import requests import os response_id = "resp_abc123" response = requests.delete( f"https://api.freddy.aitronos.com/v1/model/response/{response_id}", headers={ "Authorization": f"Bearer {os.environ['FREDDY_API_KEY']}" }, params={ "organizationId": "org_abc123" } ) result = response.json() print(f"Status: {result['status']}") print(f"Cancelled at: {result['cancelledAt']}") ``` ```javascript const responseId = 'resp_abc123'; const response = await fetch(`https://api.freddy.aitronos.com/v1/model/response/${responseId}?organizationId=org_abc123`, { method: 'DELETE', headers: { 'Authorization': `Bearer ${process.env.FREDDY_API_KEY}` } }); const result = await response.json(); console.log(`Status: ${result.status}`); console.log(`Cancelled at: ${result.cancelledAt}`); ``` Success Response ```json { "id": "resp_abc123", "object": "response", "status": "cancelled", "cancelledAt": 1735689610, "message": "Response cancelled successfully" } ``` Error Responses ```json 400 Bad Request { "error": { "message": "Response cannot be cancelled. Only responses with status 'processing' can be cancelled.", "type": "invalid_request_error", "code": "invalid_status", "param": "response_id" } } ``` ```json 404 Not Found { "error": { "message": "Response not found", "type": "not_found_error", "code": "response_not_found" } } ``` ```json 401 Unauthorized { "error": { "message": "Invalid API key provided", "type": "authentication_error", "code": "invalid_api_key" } } ``` ```json 403 Forbidden { "error": { "message": "Organization access denied", "type": "permission_error", "code": "insufficient_permissions", "param": "organizationId" } } ``` ```json 409 Conflict { "error": { "message": "Response already completed or cancelled", "type": "invalid_request_error", "code": "response_already_finalized" } } ``` ## Notes - **Status Requirement**: Only responses with status `processing` can be cancelled - **Immediate Effect**: Cancellation takes effect immediately and stops all processing - **No Refund**: Cancelled responses may still incur charges for processing that occurred before cancellation - **Status Check**: Use [Get Response Status](/docs/api-reference/responses/get-status) to verify the cancellation was successful ## Related Resources - [Get Response Status](/docs/api-reference/responses/get-status) - [Create Response](/docs/api-reference/responses/create) - [Response Object](/docs/api-reference/responses/object) - [Authentication Guide](/docs/api-reference/authentication)