X credit API
Read the prepaid balance that pays for X API usage and quote an X action before running it.
| Operation | Method and path |
|---|---|
| Get credit balance | GET /api/v1/billing/credits/balance |
| Quote a metered X action | POST /api/v1/billing/billable-usage/quote |
GET
/api/v1/billing/credits/balance Get credit balance
credit.getCreditBalance · requires x-api-key
Example
curl -X GET "https://api.siaran.my/api/v1/billing/credits/balance" \
-H "x-api-key: $SIAR_API_KEY" Response 200
10 top-level fields
-
organizationIdstring required -
currencystring requiredOne of:usd -
balanceMicrosinteger required -
heldMicrosinteger required -
availableMicrosinteger required -
balanceCentsinteger required -
availableCentsinteger required -
lowBalanceThresholdMicrosinteger required nullable -
lowBalanceboolean required -
updatedAtstring required nullable date-time
Errors: 400 Validation failed · 401 Missing or invalid API key · 403 Plan limit or permission · 404 Not found · 429 Rate limited · 500 Server error · 502 Network error
POST
/api/v1/billing/billable-usage/quote Quote a metered X action
credit.quoteBillableUsage · requires x-api-key
Request body application/json
-
teamIdstring required min length 1 -
textstring default "" -
textsstring[] -
actionstringOne of:TWITTER_CONTENT_CREATETWITTER_CONTENT_CREATE_WITH_URLTWITTER_CONTENT_MANAGETWITTER_INTERACTION_DELETETWITTER_POST_READTWITTER_USER_READTWITTER_USER_INTERACTION_CREATE -
altTextCountinteger ≥ 0 -
quantityinteger default 1 ≥ 1
Example
curl -X POST "https://api.siaran.my/api/v1/billing/billable-usage/quote" \
-H "x-api-key: $SIAR_API_KEY" \
-H "content-type: application/json" \
-d '{
"teamId": "TEAM_ID"
}' Response 200
8 top-level fields
-
billableboolean required -
linesobject[] required6 fields
-
actionstring requiredOne of:TWITTER_CONTENT_CREATETWITTER_CONTENT_CREATE_WITH_URLTWITTER_CONTENT_MANAGETWITTER_INTERACTION_DELETETWITTER_POST_READTWITTER_USER_READTWITTER_USER_INTERACTION_CREATE -
labelstring required -
unitAmountMicrosinteger required -
amountMicrosinteger required -
amountCentsinteger required -
currencystring requiredOne of:usd
-
-
totalMicrosinteger required -
totalCentsinteger required -
currencystring requiredOne of:usd -
availableMicrosinteger required -
availableCentsinteger required -
wouldExceedBalanceboolean required
Errors: 400 Validation failed · 401 Missing or invalid API key · 403 Plan limit or permission · 404 Not found · 429 Rate limited · 500 Server error · 502 Network error