X credit API

Read the prepaid balance that pays for X API usage and quote an X action before running it.

OperationMethod and path
Get credit balanceGET /api/v1/billing/credits/balance
Quote a metered X actionPOST /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
  • organizationId string required
  • currency string required
    One of: usd
  • balanceMicros integer required
  • heldMicros integer required
  • availableMicros integer required
  • balanceCents integer required
  • availableCents integer required
  • lowBalanceThresholdMicros integer required nullable
  • lowBalance boolean required
  • updatedAt string 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

  • teamId string required min length 1
  • text string default ""
  • texts string[]
  • action string
    One of: TWITTER_CONTENT_CREATE TWITTER_CONTENT_CREATE_WITH_URL TWITTER_CONTENT_MANAGE TWITTER_INTERACTION_DELETE TWITTER_POST_READ TWITTER_USER_READ TWITTER_USER_INTERACTION_CREATE
  • altTextCount integer ≥ 0
  • quantity integer 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
  • billable boolean required
  • lines object[] required
    6 fields
    • action string required
      One of: TWITTER_CONTENT_CREATE TWITTER_CONTENT_CREATE_WITH_URL TWITTER_CONTENT_MANAGE TWITTER_INTERACTION_DELETE TWITTER_POST_READ TWITTER_USER_READ TWITTER_USER_INTERACTION_CREATE
    • label string required
    • unitAmountMicros integer required
    • amountMicros integer required
    • amountCents integer required
    • currency string required
      One of: usd
  • totalMicros integer required
  • totalCents integer required
  • currency string required
    One of: usd
  • availableMicros integer required
  • availableCents integer required
  • wouldExceedBalance boolean 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