Billing

Revoke a user's bonus credits

Admin-only endpoint that reverses a bonus credit grant, for example one made in error or to the wrong account. The reversal is idempotent on idempotency_key. It reclaims at most the credits still unspent, so a balance is never driven negative by credits the user already spent.

post/admin/billing/users/{id}/credits/revoke

Request

  • Base URL: https://api.crawlora.net/api/v1
  • URL: https://api.crawlora.net/api/v1/admin/billing/users/{id}/credits/revoke
  • Auth: API key in header x-api-key

Path parameters

idstring required

User id

Headers

x-api-keystring required

Admin API key required unless an Admin JWT is already present

Request body

creditsinteger

credits is the number of credits to grant or revoke. Must be positive.

idempotency_keystring

idempotency_key makes the operation replay-safe: repeating a request with the same key applies it once.

reasonstring

reason is the justification, recorded on the user's billing state.

Example request

{
  "credits": 5000,
  "idempotency_key": "support-4821-comp",
  "reason": "goodwill credit for the 2026-07-12 outage"
}

Response

Updated credit snapshot

codeinteger
msgstring

Example response

{
  "code": 200,
  "data": {
    "allow_overage": true,
    "created_at": "2026-04-01T00:00:00Z",
    "credits_remaining": 398750,
    "credits_used": 1250,
    "currency": "usd",
    "daily_credit_limit": 25000,
    "daily_credits_remaining": 24100,
    "daily_credits_used": 900,
    "daily_key": "2026-04-16",
    "expected_subscription_amount_cents": 7900,
    "expected_total_amount_cents": 7900,
    "included_credits": 400000,
    "pending_plan": "Starter",
    "pending_plan_effective_at": "2026-05-01T00:00:00Z",
    "period_end": "2026-05-01T00:00:00Z",
    "period_key": "2026-04",
    "period_start": "2026-04-01T00:00:00Z",
    "plan": "Pro",
    "pricing_source": "plan_default",
    "subscription_price_cents": 7900,
    "updated_at": "2026-04-16T10:00:00Z",
    "user_id": "user-1"
  },
  "msg": "OK"
}

Changes

No recorded changes to this operation across all 2 revisions of this API.