Skip to main content
Dreams

Cancel a Dream

Cancel a pending or running Dream.

POST /api/v1/forward/dreams/{id}/cancel Only Dreams in the pending or running state can be canceled. Calling this endpoint again for an already canceled Dream returns the current object idempotently.

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT or admin SAT>.

Path parameters

ParameterTypeRequiredDescription
idstringYesDream ID with the drm_ prefix.

Example request

curl -s -X POST 'https://api.qoder.com/api/v1/forward/dreams/drm_019e86b4a8f070a3b6c5d4e3f2a1b0c9/cancel' \
  -H "Authorization: Bearer $QODER_PAT"

Example response

HTTP 200 OK
{
  "id": "drm_019e86b4a8f070a3b6c5d4e3f2a1b0c9",
  "type": "dream",
  "status": "canceled",
  "inputs": [{
    "type": "memory_store",
    "memory_store_id": "memstore_019e5cdb9c3f71c3b6505eba937a40b4"
  }],
  "outputs": [],
  "model": { "id": "auto" },
  "instructions": "",
  "usage": {
    "input_tokens": 1000,
    "output_tokens": 200,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 500
  },
  "error": null,
  "created_at": "2026-09-15T03:00:00Z",
  "ended_at": "2026-09-15T03:01:15Z",
  "archived_at": null
}

Response fields

FieldTypeDescription
Return valueobjectThe canceled Dream object, with status set to canceled.

Errors

HTTPTypeTrigger
400invalid_request_errorInvalid id, non-empty request body, or the Dream is in a terminal state that cannot be canceled. error.code can be invalid_dream_id, invalid_request_body, or dream_not_cancelable.
401authentication_errorAuthentication is missing, invalid, or expired.
403permission_errorThe token cannot manage Dreams. Identity SAT is not supported by this endpoint.
404not_found_errorThe Dream does not exist or is not visible to the caller. error.code is dream_not_found.
429rate_limit_errorThe request rate limit has been reached.
500/502/503api_errorThe service or an internal dependency is temporarily unavailable.
Best Practices
API reference