Skip to main content
POST
Twitter API billing: instant X API credit top-up
Add API credits from the Xquik dashboard with a saved payment method.

Add API credits with a saved payment method

Use quick top-up after the dashboard confirms an amount from USD 10 through 500. This route requires a same-origin Xquik session. External integrations must use the hosted top-up endpoint. Read outcome before handling any other response field. charged means the credits and new balance are ready. requires_action means the client must complete payment authentication. declined means the saved method failed. no_payment_method means the account has no reusable payment method. Never print or persist clientSecret. Pass it directly to the payment confirmation flow. Log only the outcome, added credits, and resulting balance after a successful charge. Quick top-up differs from standard checkout status. The status route polls a hosted checkout session by session_id. This route returns its own immediate payment outcome for the saved payment method.
Free - does not consume credits

Headers

string
required
Must be application/json.

Body

number
required
Amount in US dollars to charge. Minimum 10,maximum10, maximum 500.
At USD 0.00015 per credit, a USD 25 quick top-up adds 166,666 credits, rounded down to whole credits. Only charged grants credits. Complete requires_action with clientSecret. Use hosted checkout for declined or no_payment_method.

Response

200 Charged

Payment succeeded immediately. Credits added to your balance.
string
Always "charged".
string
Updated credit balance after top-up (Bigint string).
string
Number of credits added (Bigint string).

200 Requires action

Payment requires additional authentication (e.g., 3D Secure). Use the returned client secret with the billing confirmation flow to complete the payment.
string
Always "requires_action".
string
Payment client secret for completing the payment.

200 No payment method

No saved payment method on file. Redirect the user to add one via the billing portal, or use the standard top-up endpoint instead.
string
Always "no_payment_method".

200 Declined

The saved method failed. Open hosted checkout so the user can choose another.
string
Always "declined".

400 Invalid input

The request body is missing a numeric dollars value or includes too many decimal places.

401 Unauthenticated

Missing or invalid API key.

429 Rate limited

Too many requests. Wait for the Retry-After header before retrying.