---
title: "Revoke a user's bonus credits"
method: POST
path: "/admin/billing/users/{id}/credits/revoke"
tags: ["Billing"]
---

# Revoke a user's bonus credits

`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`

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.

## Path parameters

- `id` string, required

## Headers

- `x-api-key` string, required

## Request body

- BillingAdminCreditGrantRequestDoc
  - `credits` integer: credits is the number of credits to grant or revoke. Must be positive.
  - `idempotency_key` string: idempotency_key makes the operation replay-safe: repeating a request with the same key applies it once.
  - `reason` string: reason is the justification, recorded on the user's billing state.

## Response `200`

Updated credit snapshot

- BillingBillingStateResponseDoc
  - `code` integer
  - `data` BillingBillingStateDoc
    - `allow_overage` boolean
    - `created_at` string
    - `credits_remaining` integer
    - `credits_used` integer
    - `currency` string
    - `daily_credit_limit` integer
    - `daily_credits_remaining` integer
    - `daily_credits_used` integer
    - `daily_key` string
    - `expected_subscription_amount_cents` integer
    - `expected_total_amount_cents` integer
    - `hard_limit` boolean
    - `included_credits` integer
    - `overage_credits` integer
    - `pending_plan` string
    - `pending_plan_effective_at` string
    - `period_end` string
    - `period_key` string
    - `period_start` string
    - `plan` string
    - `pricing_source` string
    - `subscription_price_cents` integer
    - `updated_at` string
    - `user_id` string
  - `msg` string

## Other responses

- `400`: Invalid request body
- `401`: Authentication required
- `403`: Admin plan required
- `500`: Internal server error

---

[API](https://skmtc.dev/crawlora/apis/crawlora-api.md) · [All operations](https://skmtc.dev/crawlora/apis/crawlora-api/llms.txt) · [OpenAPI document](https://skmtc.dev/crawlora/apis/crawlora-api/revisions/afac9b012a27?raw)
