Get credit balance, packs, and recent transactions
GET
/api/v1/credits
Authentication
Bearer Token API Key (cookie: better-auth.session_token)
Responses
200
Credit account summary
application/jsonbalance
number
REQUIRED
packs
object[]
REQUIRED
Array of:
id
string
REQUIRED
Enum:
5, 20, 50, 100credits
number
REQUIRED
price
number
REQUIRED
perCredit
number
REQUIRED
savings
number
REQUIRED
label
string
REQUIRED
popular
boolean
autoTopoff
object
REQUIRED
enabled
boolean
REQUIRED
packId
string
REQUIRED
Enum:
5, 20, 50, 100recentTransactions
object[]
REQUIRED
Array of:
id
string
REQUIRED
user_id
string
REQUIRED
type
string
REQUIRED
Enum:
purchase, auto_topoff, deduct, refund, bonusamount
number
REQUIRED
balance_after
number
REQUIRED
pack_id
string | null
REQUIRED
description
string | null
REQUIRED
created_at
string
REQUIRED
401
Unauthorized
curl -X GET 'https://littledemo.com/api/v1/credits' \ -H 'Authorization: Bearer YOUR_API_TOKEN'
const response = await fetch('https://littledemo.com/api/v1/credits', { method: 'GET', headers: { "Authorization": "Bearer YOUR_API_TOKEN" }});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.get('https://littledemo.com/api/v1/credits', headers=headers)print(response.json())
200
Response
{ "balance": 123, "packs": [ { "id": "5", "credits": 123, "price": 123, "perCredit": 123, "savings": 123, "label": "<string>", "popular": true } ], "autoTopoff": { "enabled": true, "packId": "5" }, "recentTransactions": [ { "id": "<string>", "user_id": "<string>", "type": "purchase", "amount": 123, "balance_after": 123, "pack_id": "<string>", "description": "<string>", "created_at": "<string>" } ]}
API Playground
Try this endpoint
GET
/api/v1/credits