Grant or withdraw the auto-renewal consent on a referral
POST/referrals/:id/consent/auto-renew
Sets Referral.autoRenewalConsented (+ autoRenewalConsentedAt) so the RenewalGenerationJob picks the source referral up for automatic renewal cycles. Emits referral.auto_renew.consent (or .consent_withdrawn) with the consentSource on the audit event. CPA §37 requires the affirmative act to be captured before an automated renewal fires; DPPA §11 requires that automated decisions have a challenge path — this endpoint is that path.
Request
Responses
- 200
- 201
- 400
- 401
- 403
- 404
- 409
- 429
- 500
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.
The authenticated caller does not carry the required permission or is scoped out of this resource by the object-authorization service (e.g. an agent trying to view another agent's referrals). Grant the missing permission via a role change or scope the query to resources the caller owns.
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 conflicts with the current state of the target resource — a duplicate unique field on registration, an idempotency-key replay with a different payload, or a webhook eventId that has already been processed. error.code may be CONFLICT or IDEMPOTENCY_CONFLICT depending on the cause.
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.