| Location | Name | Required | Meaning |
|---|---|---|---|
| path | sub | Yes | Use the ID from an authorized staff response; source validators reject malformed IDs. |
| header | X-Admin-CSRF | Yes | Session-bound token from the staff page; not a developer credential. |
| header | X-Admin-Reason | Yes | URI-encoded written audit reason; Cloud/billing may reuse a fresh target-specific session marker. |
{error:{code,message}} for CloudError failures, attaches Request-Id, and disables caching. Handle 401 by signing in; show role refusal for 403 forbidden, reauthenticate only for step_up_required, and collect a reason for 400 reason_required. A CSRF failure needs a current page/session token, not blind retries. Operation-specific 404/409/413/422/502/503 errors retain their status. Honor Retry-After on 429./**
* POST /api/admin/accounts/:sub/restore: ends a scheduled deletion within the grace period (accounts.restore; step-up
* and X-Admin-Reason are enforced by adminRoute from the role matrix). Enables the Cognito user; audited.
*/
export const POST = adminRoute("accounts.restore", async (_request, ctx, { params }: Context) => {
const { sub } = await params;
return adminJson({ hold: await restore(ctx, sub, ctx.reason!) });
}, { stepUp: true, reason: true, rateLimit: "holds" });