Cancel a task
POST/api/gateway/v1/tasks/{id}/cancel
Reads and cancellation use the original frozen task identity, not current model configuration. The key must retain modelInvoke and permission for the original project and route. Task recovery remains available during financial recovery subject to current identity and product authorization. Unknown or expired tasks may have been submitted: inspect and reconcile the existing task before creating another invocation. HTTP disconnect does not cancel a task. Cancellation is a request, not a guarantee that provider work stops. Poll until a terminal outcome; cancelSupported indicates remote cancellation capability.
Organization API key authentication
Authorization: Bearer $SINECLOUD_API_KEYRequired scopes: modelInvoke
Parameters
id· path · RequiredrouteId· query · Optional- Optional original route assertion; mismatches return 404. Takes precedence over x-sine-route-id.
x-sine-route-id· header · Optional- Optional original route assertion when routeId is absent.
x-sine-project-id· header · Optional- Select an organization project. A project-restricted key defaults to its bound project and cannot select another project. The projectId query parameter takes precedence.
projectId· query · Optional- Optional project selection; takes precedence over x-sine-project-id and must respect the key restriction.
Request body
Optional
application/json
Responses
200- Task already completed, failed or cancelled, or cancellation completed immediately.
202- Cancellation requested; task remains nonterminal, including unknown or expired states.
400- Invalid request, project identifier, unsupported model parameters or operation configuration.
401- Missing, expired, revoked or invalid organization Bearer API key.
403- The key scope, project restriction, route policy, current membership or product entitlement denies access.
404- The project, route or authorized task was not found.
409- task_cancel_unsupported: remote cancellation is unavailable; task_submission_unknown: reconcile the original upstream binding before cancellation.
413- Cancellation JSON exceeds 256 KiB.
415- Use application/json when sending a cancellation body.
429- Rate or concurrency limit reached. Honor Retry-After when returned.
500- Sanitized Cloud or Gateway failure.
503- Gateway or durable task execution is unavailable. Restore the required service before continuing.