# Cancel a provider integration attempt Launch state: **Live**. Agents can register at /auth.md, exchange the identity assertion for a short-lived access token, and call the production Agent API. Contract status: **implemented**. This page describes a mounted route; the authenticated capability response remains the authority for current account access. ## Request `POST /api/agent/v1/integrations/attempts/{attemptId}/cancel` Operation ID: `cancelAgentIntegrationAttempt` Send a short-lived access token obtained through [auth.md](https://neotask.ai/auth.md) for `https://neotask.ai/api/agent` in the `Authorization: Bearer` header. The token must include `neotask:integrations:write`. Send an `Idempotency-Key` header with 8-200 characters. Reuse it only for an identical retry. For 24 hours, an identical retry returns the outcome recorded for the first request, with the same status and body, instead of running the operation again; a recorded failure is returned as that same failure. A readiness refusal returned before the operation started (for example `setup_required` with `runner_not_enrolled`, or `temporarily_disabled` with `run_execution_disabled`, `runner_offline` or `cloud_gateway_not_connected`) is not recorded, so the identical retry runs once the runner or gateway is ready. The JSON request body uses `AgentIntegrationAttemptCancelRequest` in OpenAPI. ## Response The terminal cancelled attempt state. The JSON schema is `AgentIntegrationAttemptResponse` in [OpenAPI](https://neotask.ai/openapi.yaml). - Cancellation is idempotent and scoped to the verified tenant, principal, and registration. ## Errors | HTTP | Codes | Meaning | Next action | |---:|---|---|---| | 400 | `invalid_request`, `invalid_idempotency_key` | The request body or Idempotency-Key is malformed. | Correct the documented input. Reuse an idempotency key only for the identical mutation. | | 409 | `idempotency_conflict`, `idempotency_in_progress` | The idempotency key belongs to another request or its first request is still running. | Do not change the request under the same key. Retry later or use a new key for new work. | | 409 | `claim_required`, `unsupported_auth_type`, `connection_not_active`, `connection_generation_conflict`, `human_approval_required` | The agent must claim its account, use a reviewed provider/authentication type, or complete the required human approval before changing an integration. | Read the current integration catalog/attempt state and relay the opaque human-action URL when the response provides one. | | 403 | `company_membership_required` | The requested company scope or target agent is outside the authenticated tenant/company membership. | Read the server-derived catalog targets and use only a company reference and agent returned for this tenant. | | 404 | `provider_not_found`, `attempt_not_found`, `connection_not_found`, `binding_not_found`, `agent_not_found` | The provider or tenant-scoped integration reference does not exist or is not visible to this principal. | Use only references returned by the current catalog, attempt, or connection response. | | 410 | `attempt_expired` | The short-lived provider authorization attempt is no longer valid. | Start a new attempt with a fresh idempotency key and relay its new opaque human-action URL. | | 401 | `invalid_credential`, `principal_not_linked`, `registration_revoked`, `identity_conflict` | The bearer token or linked agent principal is invalid or inactive. | Register, refresh, or claim through the documented Auth.md flow, then retry with a new token. | | 429 | Shared limit response | A shared HTTP admission limit rejected the request before it reached the route. | Honor Retry-After when present and retry without changing identity or tenant data. | | 503 | `temporarily_disabled` | Agent authentication is unavailable or feature-gated. | Do not bypass authentication. Retry only after the returned guidance or launch state changes. | ## Related resources - [Agent API index](https://neotask.ai/docs/llms.txt) - [OpenAPI JSON](https://neotask.ai/openapi.json) - [Arazzo quickstart](https://neotask.ai/arazzo.yaml) - [Knowledge manifest](https://neotask.ai/agent-public-contracts/v1/knowledge-manifest.json)