Cooling-off cancel
POST/agent-subscriptions/:id/cancel-pending
Cancels a subscription inside the CPA §37 cooling-off window (default 7 days from creation). Reverses any issued invoices for the period; flags any already-paid receipts for finance-side refund. Available to the subscription holder OR any actor with agent-subscription:cancel.
Request
Responses
- 200
- 201
- 400
- 401
- 403
- 404
- 422
- 429
- 500
Cancelled subscription with cooling-off audit trail.
Resource created. Body follows the shared { data, meta } envelope; data is the newly-created resource.
The request payload failed validation. error.details lists the offending fields with human-readable messages and the class-validator constraint that fired. Fix the payload and retry — this is not a transient failure.
Missing, malformed, or expired authentication token. Log in via POST /auth/login (or refresh via POST /auth/refresh) and retry with a fresh Authorization: Bearer <accessToken> header.
Caller lacks the required permission or the cooling-off window has closed.
The referenced resource does not exist or is not visible to the caller. Note: object-level scoping is opaque — a resource you cannot see is indistinguishable from a resource that does not exist.
The request is syntactically valid but violates a business invariant — a referral state transition not permitted from the current status, a wallet withdrawal exceeding the available balance, or a POP being confirmed before it has been ZFA-verified. error.code is one of INVALID_TRANSITION, INVARIANT_VIOLATION, or a domain-specific value; error.message explains the invariant.
Rate limit exceeded. Global default is 120 requests/minute per IP; auth-flow, OTP, self-registration, WebAuthn, IRA lookup, and public-lead endpoints carry tighter per-endpoint limits. Retry after the delay indicated by the Retry-After header.
Response Headers
Seconds to wait before retrying.
Unhandled server error. The response carries a meta.requestId correlator you can hand to platform operations to trace the failure through structured logs and the hash-chained audit trail. Retry with the same Idempotency-Key header if the endpoint accepts idempotency.