Agent-initiated top-up request (human approval required)
Lets a Bearer-authenticated agent REQUEST a prepaid-credit top-up of a specific whole-øre amount for its own API key — the machine-readable recovery path a 402 INSUFFICIENT_CREDITS body advertises in its topup_request field. This endpoint is deliberately Stripe-free: it never creates a checkout session, never touches a card, and never charges anyone, in any mode. It only records a PENDING request (24-hour expiry) that a HUMAN reviews on the billing dashboard (approval_url); only that human approval drives the existing Stripe checkout, and the human still completes payment on Stripe's hosted page. The amount is bounded twice: a 1000-øre floor (NOK 10 — below that, card fees eat the top-up) and an adjustable server-side ceiling read live from billing settings (1000 NOK at launch; over-ceiling requests get a 400 naming both the requested amount and the current ceiling, plus both remedies — lower the amount, or hand over to a human who can top up without any ceiling). Every valid, non-revoked key may call this (no scope requirement): requesting is not a data read, and a key that just hit 402 must be able to ask for funding regardless of how narrowly its scopes are cut. Both the consumer and the funded key are taken exclusively from the authenticated key — the body carries only the amount, so cross-key or cross-tenant requests are structurally impossible. Abuse-bounded by a fail-closed 5/hour per-key rate limit and a cap of 3 outstanding pending requests per consumer. Supports the Idempotency-Key header (a replay returns the stored 201 without creating a second request).
Request
- Base URL: https://www.apier.no
- URL: https://www.apier.no/api/v1/billing/topup-requests
- Auth: HTTP bearer
Request body
Response
The pending top-up request. Nothing has been charged and no checkout exists yet — a human must approve the request at approval_url before any payment can start; unresolved requests expire at expires_at (24 hours after creation).
Changes
No recorded changes to this operation across all 1 revision of this API.