Skip to main content

Documentation Index

Fetch the complete documentation index at: https://brezelscraper.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

GET /api/v1/credits/balance

Return the authenticated user’s current credit balance.

Example response

{
  "user_id": "user_123",
  "credit_balance": "25",
  "total_credits_purchased": "100"
}
Credit values are returned as decimal strings (e.g., "25.123456") to preserve precision. Parse them as decimals, not as floating-point numbers.

GET /api/v1/credits/history

Return paginated credit transaction history.

Query parameters

ParameterTypeDefaultNotes
pageinteger1Must be positive
limitinteger50Max 100
typestringemptyFilter by transaction type
Common transaction types:
  • purchase
  • consumption
  • bonus
  • refund
  • adjustment
In some edge cases you may also see refund_deficit or deficit_paydown in the response history.

Example response

{
  "transactions": [
    {
      "id": "018efdf7-7fe1-7c42-b4e2-123456789abc",
      "type": "purchase",
      "amount": "25",
      "balance_before": "0",
      "balance_after": "25",
      "description": "Stripe checkout session",
      "reference_id": "cs_test_123",
      "reference_type": "stripe_checkout_session",
      "created_at": "2026-04-10T09:00:00Z"
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 50,
  "has_more": false
}

POST /api/v1/credits/checkout-session

Create a Stripe Checkout session to buy credits.

Request body

{
  "credits": "25",
  "currency": "USD"
}
Rules:
  • credits must be a whole positive integer
  • Maximum credits per checkout session is 10000
  • currency currently supports USD only

Success response

{
  "session_id": "cs_test_123",
  "url": "https://checkout.stripe.com/..."
}
Redirect the user to url to complete the purchase.

POST /api/v1/credits/reconcile

Confirm a completed checkout session against the authenticated user.

Request body

{
  "session_id": "cs_test_123"
}
Returns 204 No Content on success. Use this after the user returns from Stripe if you want to refresh credits immediately instead of waiting for normal background settlement.