API Reference
Auto-generated
Billing
API reference for billing endpoints.
Auto-generated
This page was generated from the OpenAPI spec. Run
make generate-docs to refresh after spec changes.GET /api/v1/billing/audit-log
GET
/api/v1/billing/audit-logGet billing audit log
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | Optional | limitDefault: 20 |
| offset | integer | Optional | offsetDefault: 0 |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/audit-log \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"entries": [],
"total": 0,
"has_more": true
}GET /api/v1/billing/auto-recharge
GET
/api/v1/billing/auto-rechargeGet auto-recharge settings
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/auto-recharge \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"id": "example",
"user_id": "example",
"enabled": true,
"threshold_microcents": 0,
"threshold_display": "example",
"recharge_amount_cents": 0
}PUT /api/v1/billing/auto-recharge
PUT
/api/v1/billing/auto-rechargeUpdate auto-recharge settings
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | Optional | Enable auto-rechargeDefault: False |
| threshold_microcents | integer | Optional | Recharge when balance drops below this (microcents). 1,000,000 = $0.01Default: 500000000 |
| recharge_amount_cents | integer | Optional | Amount to charge in cents ($25-$2000)Default: 5000 |
| stripe_payment_method_id | string | Optional | stripe_payment_method_id |
| consent_text | string | Optional | consent_text |
| consent_source | "deposit_flow" | "success_page" | "settings" | Optional | consent_source |
| terms_version | string | Optional | terms_version |
Request Example
Bash
curl -X PUT https://api.alterlab.io/api/v1/billing/auto-recharge \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": false,
"threshold_microcents": 500000000,
"recharge_amount_cents": 5000
}'Response Example
JSON
{
"id": "example",
"user_id": "example",
"enabled": true,
"threshold_microcents": 0,
"threshold_display": "example",
"recharge_amount_cents": 0
}DELETE /api/v1/billing/auto-recharge
DELETE
/api/v1/billing/auto-rechargeDisable auto-recharge
Request Example
Bash
curl -X DELETE https://api.alterlab.io/api/v1/billing/auto-recharge \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}GET /api/v1/billing/auto-recharge/history
GET
/api/v1/billing/auto-recharge/historyGet auto-recharge history
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| page | integer | Optional | Page numberDefault: 1 |
| per_page | integer | Optional | Results per pageDefault: 20 |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/auto-recharge/history \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}POST /api/v1/billing/auto-recharge/test
POST
/api/v1/billing/auto-recharge/testTest auto-recharge
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/auto-recharge/test \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"success": true,
"payment_method_valid": true,
"card_expired": true,
"card_days_until_expiry": "example",
"message": "example",
"card_brand": "example"
}GET /api/v1/billing/balance
GET
/api/v1/billing/balanceGet current balance
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/balance \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"balance_microcents": 0,
"balance_display": "example",
"total_deposited_cents": 0,
"total_spent_cents": 0,
"tier": "example",
"auto_recharge": "example"
}POST /api/v1/billing/change-plan
POST
/api/v1/billing/change-planChange Plan
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/change-plan \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}POST /api/v1/billing/checkout
POST
/api/v1/billing/checkoutCreate a checkout session
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| price_id | string | Required | Price Id |
| success_url | string | Required | Success Url |
| cancel_url | string | Required | Cancel Url |
| mode | string | Optional | ModeDefault: subscription |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/checkout \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"price_id": "example_price_id",
"success_url": "example_success_url",
"cancel_url": "example_cancel_url",
"mode": "example_mode"
}'Response Example
JSON
{
"session_id": "example",
"url": "example"
}GET /api/v1/billing/cost-projection
GET
/api/v1/billing/cost-projectionGet cost projection
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| X-Organization-Id | string | Optional | X-Organization-Id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/cost-projection \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"usage_trend": "example",
"credits_used": 0,
"credits_allocated": 0
}GET /api/v1/billing/credit-transactions
GET
/api/v1/billing/credit-transactionsGet credit transactions
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | Optional | limitDefault: 20 |
| offset | integer | Optional | offsetDefault: 0 |
| reference_type | string | Optional | Filter by reference_type (e.g. 'crawl') |
| X-Organization-Id | string | Optional | X-Organization-Id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/credit-transactions \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"transactions": [],
"total": 0,
"has_more": true
}POST /api/v1/billing/deposit
POST
/api/v1/billing/depositCreate a deposit
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| amount_cents | integer | Required | Amount to deposit in cents ($10-$2000) |
| success_url | string | Optional | success_url |
| cancel_url | string | Optional | cancel_url |
| promo_code | string | Optional | promo_code |
| auto_recharge_enabled | boolean | Optional | If true, enable auto-recharge after successful depositDefault: False |
| auto_recharge_threshold_microcents | integer | Optional | auto_recharge_threshold_microcents |
| auto_recharge_amount_cents | integer | Optional | auto_recharge_amount_cents |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/deposit \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount_cents": 0,
"auto_recharge_enabled": false
}'Response Example
JSON
{
"session_id": "example",
"url": "example",
"amount_cents": 0,
"amount_display": "example"
}GET /api/v1/billing/invoices
GET
/api/v1/billing/invoicesGet invoice history
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | Optional | limitDefault: 10 |
| X-Organization-Id | string | Optional | X-Organization-Id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/invoices \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}GET /api/v1/billing/payment-methods
GET
/api/v1/billing/payment-methodsList payment methods
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/payment-methods \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"payment_methods": [],
"default_method_id": "example"
}POST /api/v1/billing/payment-methods
POST
/api/v1/billing/payment-methodsAdd a payment method
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| payment_method_id | string | Required | Payment Method Id |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/payment-methods \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"payment_method_id": "example_payment_method_id"
}'Response Example
JSON
{
"id": "example",
"stripe_payment_method_id": "example",
"type": "example",
"card_brand": "example",
"card_last4": "example",
"card_exp_month": "example"
}DELETE /api/v1/billing/payment-methods/{payment_method_id}
DELETE
/api/v1/billing/payment-methods/{payment_method_id}Remove a payment method
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| payment_method_id | string | Required | payment_method_id |
Request Example
Bash
curl -X DELETE https://api.alterlab.io/api/v1/billing/payment-methods/<payment_method_id> \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}POST /api/v1/billing/payment-methods/{payment_method_id}/default
POST
/api/v1/billing/payment-methods/{payment_method_id}/defaultSet default payment method
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| payment_method_id | string | Required | payment_method_id |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/payment-methods/<payment_method_id>/default \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}POST /api/v1/billing/portal
POST
/api/v1/billing/portalCreate a Stripe portal session
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/portal \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"url": "example"
}POST /api/v1/billing/promo/validate
POST
/api/v1/billing/promo/validateValidate Promo Code
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| code | string | Required | Code |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/promo/validate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "example_code"
}'Response Example
JSON
{
"valid": true,
"bonus_type": "example",
"bonus_value": "example",
"max_credits_microcents": "example",
"max_credits_display": "example",
"min_deposit_cents": "example"
}GET /api/v1/billing/recent-activity
GET
/api/v1/billing/recent-activityGet recent billing activity
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | Optional | limitDefault: 10 |
| offset | integer | Optional | offsetDefault: 0 |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/recent-activity \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"activities": [],
"total": 0,
"has_more": true
}POST /api/v1/billing/setup-intent
POST
/api/v1/billing/setup-intentCreate a setup intent
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/setup-intent \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"client_secret": "example",
"id": "example"
}GET /api/v1/billing/subscription
GET
/api/v1/billing/subscriptionGet Subscription
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/subscription \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"status": "ok"
}GET /api/v1/billing/usage-alerts
GET
/api/v1/billing/usage-alertsGet usage alert settings
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/usage-alerts \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"enabled": true,
"threshold_50_enabled": true,
"threshold_75_enabled": true,
"threshold_90_enabled": true,
"threshold_100_enabled": true,
"email_enabled": true
}PUT /api/v1/billing/usage-alerts
PUT
/api/v1/billing/usage-alertsUpdate usage alert settings
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | Optional | EnabledDefault: True |
| threshold_50_enabled | boolean | Optional | Threshold 50 EnabledDefault: False |
| threshold_75_enabled | boolean | Optional | Threshold 75 EnabledDefault: True |
| threshold_90_enabled | boolean | Optional | Threshold 90 EnabledDefault: True |
| threshold_100_enabled | boolean | Optional | Threshold 100 EnabledDefault: True |
| email_enabled | boolean | Optional | Email EnabledDefault: True |
| webhook_url | string | Optional | webhook_url |
Request Example
Bash
curl -X PUT https://api.alterlab.io/api/v1/billing/usage-alerts \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": false,
"threshold_50_enabled": false,
"threshold_75_enabled": false,
"threshold_90_enabled": false,
"threshold_100_enabled": false
}'Response Example
JSON
{
"enabled": true,
"threshold_50_enabled": true,
"threshold_75_enabled": true,
"threshold_90_enabled": true,
"threshold_100_enabled": true,
"email_enabled": true
}GET /api/v1/billing/usage-breakdown
GET
/api/v1/billing/usage-breakdownGet usage breakdown
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| X-Organization-Id | string | Optional | X-Organization-Id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/usage-breakdown \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"light": "example",
"js": "example",
"pdf": "example",
"ocr": "example",
"crawl": "example",
"total_credits": 0
}GET /api/v1/billing/usage-chart
GET
/api/v1/billing/usage-chartGet usage chart data
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| days | integer | Optional | daysDefault: 30 |
| X-Organization-Id | string | Optional | X-Organization-Id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/usage-chart \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"data": [],
"period": "example"
}GET /api/v1/billing/usage-realtime
GET
/api/v1/billing/usage-realtimeGet real-time usage
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| X-Organization-Id | string | Optional | X-Organization-Id |
Request Example
Bash
curl -X GET https://api.alterlab.io/api/v1/billing/usage-realtime \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"Response Example
JSON
{
"credits_used_today": 0,
"credits_used_week": 0,
"credits_used_month": 0,
"requests_today": 0,
"requests_week": 0,
"requests_month": 0
}POST /api/v1/billing/verify/confirm
POST
/api/v1/billing/verify/confirmVerify Code
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| challenge_id | string | Required | Challenge Id |
| code | string | Required | Code |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/verify/confirm \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"challenge_id": "example_challenge_id",
"code": "example_code"
}'Response Example
JSON
{
"success": true,
"message": "example",
"remaining_attempts": 0
}POST /api/v1/billing/verify/initiate
POST
/api/v1/billing/verify/initiateInitiate Verification
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| action | string | Required | Action |
| method | string | Optional | MethodDefault: email |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/billing/verify/initiate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "example_action",
"method": "example_method"
}'Response Example
JSON
{
"challenge_id": "example",
"method": "example",
"action": "example",
"expires_at": "example",
"masked_destination": "example"
}