DEVELOPER DOCUMENTATION
Create Credit Top-Up
Start a credit top-up — returns a Stripe Checkout URL a human must pay. Nothing is charged by this call.
/api/public/v1/credits/top-upsStarts a prepaid credit top-up. This call never charges anything. It creates a PENDING top-up and returns a Stripe Checkout checkoutUrl that a signed-in human must open and pay; once checkout completes, the credits land automatically. The link expires unpaid after ~24 hours (expiresAt).
Learn the outcome by polling GET /credits/top-ups/{topUpId} until the status is COMPLETED, then confirm the new balance with GET /credits.
Requirements: payments:write scope + the public_api_credits feature + a claimed account (unclaimed accounts get 403 with details.reason: "account_claim_required" and a claimUrl).
Request
Section titled “Request”amountUsdnumberbodyrequiredTop-up amount in US dollars. Minimum $10, maximum $10,000. (amount is accepted as an alias.)
Response
Section titled “Response”Returns 201 — the top-up exists, but no money has moved until the human pays the checkout link.
topUpIdstringThe top-up ID, for polling.
checkoutUrlstringStripe Checkout URL — show it to your human so they can complete the payment.
expiresAtstring | nullISO timestamp when the unpaid checkout link lapses (~24h).
topUpobjectThe full top-up record: {id, status: "PENDING", amountCents, createdAt, completedAt, expiresAt} — same shape as GET /credits/top-ups/{topUpId}.
messagestringExplains the human-payment handoff.
Errors
Section titled “Errors”| Status | code | Meaning |
|---|---|---|
400 | BAD_REQUEST | Body is not valid JSON, amountUsd missing/non-numeric, or outside $10–$10,000 (details: {field: "amountUsd"}) |
401 | UNAUTHORIZED | Missing or invalid token |
403 | FORBIDDEN | Missing payments:write scope, public_api_credits disabled, or account not claimed (details.reason: "account_claim_required", details.claimUrl) |