Billing

Turn auto top-up on or off, or change it

PATCH /v1/billing/auto_topup

Auto top-up buys pack with the account's saved card (off-session; sales tax added where SocialTap collects it, as at checkout) whenever a balance change leaves the balance at or below threshold, one top-up at a time, never past monthly_cap_cents in a calendar month (UTC), tax included (by default default_cap_packs (3) × the pack's price). A charge that fails is never retried: auto top-up turns off, the owner is emailed why, and a person turns it back on once the card is fixed. A top-up that would pass rolling_limit_cents in any 7 days is skipped, the owner is told how to lift it, it runs by itself once there is room, and notice says so when the chosen pack is already past it. A dispute of any payment on the account turns it off, and it turns on again only with a different card; a bank's inquiry only turns it off. The owner is emailed when anyone else turns it on or raises its cap. The dashboard session only, with a fresh sign-in: it authorizes charges to the card. Absent fields keep their value. Free.

Auth: the dashboard session cookie.

Example

cURL
curl -X PATCH 'https://socialtap.dev/v1/billing/auto_topup' \
  -H "x-api-key: $SOCIALTAP_API_KEY" \
  -H "content-type: application/json" \
  -d '{
  "enabled": true,
  "monthly_cap_cents": 1,
  "pack": "string",
  "threshold": 0
}'

The dashboard's session cookie, not an API key.

Body

application/json

JSON. Fields marked nullable may be null; optional ones may be left out.

enabled?booleannullable

true turns auto top-up on: it needs a saved card (not one disputed on this account), a pack and a threshold (the low-balance alert's when left out), and sets monthly_cap_cents to 3 × the pack's price when none was set. A balance already at or below the threshold buys the pack at the next request. false turns it off; nothing in progress is canceled.

monthly_cap_cents?integernullable

Cents; at least the pack's price (or no top-up could run).

pack?stringnullable

A credit pack ID of the catalog (packs).

threshold?integernullable

Credits.

Response

application/json

200

Turn auto top-up on or off, or change it

dataobject
ShowHide 16 child fields
currencystring

The currency of the amounts (ISO 4217).

One ofusd

enabledboolean

Whether a balance falling to threshold buys pack now.

last_chargeobjectnullable

The latest top-up, whatever its outcome; null before the first.

ShowHide 11 child fields
amount_taxintegernullable

The tax in amount_total (Stripe Tax: only where SocialTap collects it); null when amount_total is.

amount_totalintegernullable

Charged, tax included, in cents of currency; null when nothing was charged or before it is known.

created_atstring date-time

When the balance crossed the threshold, RFC 3339 UTC.

creditsinteger

Credits the pack adds.

currencystring

amount_total's currency (ISO 4217).

One ofusd

idstring

Top-up ID (atu_…): the ref of its credit_transaction, and on the Stripe payment's metadata.

messagestringnullable

What the bank or Stripe said, for people; null when reason is.

objectstring

Always auto_topup_charge.

One ofauto_topup_charge

packstring

The credit pack (catalog pack ID).

reasonstringnullable

Why it failed (the off_reason it set) or was skipped (monthly_cap, trust_limit: it would have passed rolling_limit_cents); null otherwise.

One ofcard_declinedauthentication_requiredno_cardbilling_address_requiredpayment_faileddisputedmonthly_captrust_limit

statusstring

processing (the charge is under way), succeeded (paid: its credits were added, once), failed (nothing charged: auto top-up turned off, see reason) or skipped (it would have passed the monthly cap or the 7-day limit: nothing charged, auto top-up stays on).

One ofprocessingsucceededfailedskipped

month_resets_atstring date-time

Start of the next calendar month (UTC), when spent_this_month_cents starts again from 0.

monthly_cap_centsintegernullable

The most auto top-up charges in a calendar month (UTC), tax included, in cents of currency; a top-up that would pass it does not run (the owner is emailed). null until set up.

noticestringnullable

What a person should know about the change just made, in a sentence to show them: the chosen pack can't run under rolling_limit_cents, say, so it will be skipped. It never refuses the change. Null otherwise, and on every read.

objectstring

Always auto_topup.

One ofauto_topup

off_atstring date-timenullable

When it turned itself off, RFC 3339 UTC; null when off_reason is.

off_messagestringnullable

What the bank or Stripe said, for people; null when off_reason is.

off_reasonstringnullable

Why auto top-up turned itself off (null while on, or when a person turned it off): card_declined (the bank declined the charge), authentication_required (the bank asked the cardholder to confirm it: buy the pack in Billing, then turn auto top-up back on), no_card (no saved card), billing_address_required (Stripe Tax needs the card's billing address: add it in the payment settings), payment_failed (another payment error), disputed (a payment on this account was disputed: auto top-up turns on again only with a different card), bank_inquiry (a bank asked about a payment on this account, which is not yet a dispute: turn it back on when you are ready), plan_ended (it bought a monthly plan's top-up, and the plan ended). It never retries: fix the cause, then turn it on again.

One ofcard_declinedauthentication_requiredno_cardbilling_address_requiredpayment_faileddisputedbank_inquiryplan_ended

packstringnullable

The credit pack each top-up buys (catalog pack ID); null until auto top-up is first set up.

payment_methodobjectnullable

The saved card a top-up charges (the default card in the payment settings, else the newest); null when there is none, or when the payment processor could not be reached.

ShowHide 4 child fields
brandstring

Card brand (visa, mastercard, amex, …).

exp_monthinteger

Expiry month (1–12).

exp_yearinteger

Expiry year.

last4string

The card number's last four digits.

rolling_limit_centsinteger

The most auto top-up charges in any 7 days, tax included, in cents, whatever monthly_cap_cents says: it grows with the payments that settled on this account, and support can lift it. A top-up that would pass it does not run (the owner is emailed); buying a pack by hand is never limited by it.

rolling_spent_centsinteger

What auto top-up charged in the last 7 days, tax included, counting a charge in progress, in cents.

spent_this_month_centsinteger

What auto top-up charged this calendar month, tax included, counting a charge in progress, in cents.

thresholdintegernullable

Credits: a balance change that leaves the balance at or below this buys the pack, once until the balance is above it again. null until set up.

metaobject

The shared route meta (see the API reference introduction).

400

400 Bad Request.

A parameter is missing or malformed, or the link is not one this endpoint takes.

Fix the parameter named in param as the message says. For a link of the wrong kind, call an endpoint listed in details.endpoints, when there is one.

401

401 Unauthorized.

unauthorizedNo retry

The x-api-key header is missing, or its key is unknown or revoked. On the dashboard's routes: the session cookie is missing or expired.

Send a valid API key in the x-api-key header. No key yet? A person gets one at details.signup_url; an AI agent follows details.agent_auth_url.

403

403 Forbidden.

forbiddenNo retry

The API key is valid but may not make this request, and details.reason says why: the account is suspended, the key lacks the route's scope, waits for its owner to confirm it by email, has expired, or was used from an IP outside its allowlist, or a rotated key's previous secret was used for a call that needs the admin scope. A running job stops with it too when its account is suspended or the key that created it is revoked or expires. It is about the key, never the item: a private item is private_or_unavailable, also 403, so branch on the code.

Act on details.reason. suspended: contact support. scope: use a key with details.required_scope. previous_secret: use the new secret. key_pending: have the owner open the emailed link. key_expired or key_revoked: create a new key. ip_not_allowed: call from an allowed IP.

429

429 Too Many Requests.

rate_limitedYes, later

The account passed its runaway-protection ceiling: a high per-account limit that stops a broken client loop (plans have no rate limit). Requests without an API key (signup, the MCP server's tool listing and find_endpoint) are limited per IP address instead. It also stops an account whose failed requests in the last hour cost far more than its successful ones paid for: failures are free within a limit (the message says so), and successes raise it.

Wait the seconds in the retry-after header, then retry. If your steady traffic needs more, ask support to raise the ceiling; without an API key, send one.

502

502 Bad Gateway.

upstream_errorYes, later

The platform failed, or answered with something we could not read.

Retry with backoff. Failed requests are free.

operationId billing.auto_topup.update