#What the Credits API does
The Credits API lets you look up endpoint costs and check your balance without making an actual API call. Use it to build cost-aware workflows, display pricing in your UI, or validate you have enough credits before launching a batch job.
#Endpoints
#
POST /v1/credits/cost
- Best for: Looking up the credit cost of any endpoint before calling it.
- Single lookup: Send
"endpoint": "youtube/channel/audit"to get one cost. - Bulk lookup: Send
"endpoints": ["screenshot/capture", "qr/code"]for up to 50 at once.
#
POST /v1/credits/balance
- Best for: Checking your current credit balance from code.
- Returns: Your total available credits.
#Quick start
# Look up a single endpoint cost
curl -X POST "https://api.yeb.to/v1/credits/cost" \
-H "Content-Type: application/json" \
-H "X-API-Key: <YOUR_API_KEY>" \
-d '{"endpoint": "screenshot/capture"}'
# Bulk lookup (up to 50 endpoints)
curl -X POST "https://api.yeb.to/v1/credits/cost" \
-H "Content-Type: application/json" \
-H "X-API-Key: <YOUR_API_KEY>" \
-d '{"endpoints": ["youtube/channel/audit", "qr/code", "geoip/city"]}'
# Check your balance
curl -X POST "https://api.yeb.to/v1/credits/balance" \
-H "Content-Type: application/json" \
-H "X-API-Key: <YOUR_API_KEY>"
#Parameters
Cost endpoint
| Param | Type | Required | Description |
|---|---|---|---|
endpoint |
string | One of the two | Single endpoint key, e.g. youtube/channel/audit |
endpoints |
array | One of the two | Array of up to 50 endpoint keys for bulk lookup |
Balance endpoint
No extra parameters — just authenticate with your API key.
#Reading responses
Single cost lookup
{
"endpoint": "youtube/channel/audit",
"credits": 0.01,
"credits_spent": 0.0001,
"credits_left": 142.5,
"response_code": 200,
"response_time_ms": 12
}
Bulk cost lookup
{
"costs": {
"screenshot/capture": 0.05,
"qr/code": 0.009,
"chatbot/message": 0.05
},
"credits_spent": 0.0001,
"credits_left": 142.5,
"response_code": 200,
"response_time_ms": 8
}
Balance response
{
"credits": 142.5,
"credits_spent": 0.0001,
"credits_left": 142.5,
"response_code": 200,
"response_time_ms": 8
}
#Endpoint key format
Endpoint keys follow the pattern module/action. Here are some examples:
| Key | Credits | API |
|---|---|---|
youtube/channel/audit | 0.01 | YouTube Channel |
screenshot/capture | 0.05 | Screenshot |
qr/code | 0.009 | QR Code Generator |
geoip/city | 0.009 | GeoIP |
chatbot/message | 0.05 | ChatBot |
bot/detect/detect | 0.003 | Bot Detect |
captions/transcribe | 1 | Captions |
/v1/credits/cost endpoint itself to discover costs for any key —
if a key doesn't exist, it returns null.
#Practical recipes
- Pre-flight check: Call
/balancebefore a batch job. If credits < estimated cost, abort early and notify. - Pricing page: Fetch all costs with
/costand display them dynamically — always in sync with reality. - Usage dashboard: Combine
/balancewith your transaction history to show spend over time.
#Errors
| HTTP | When | What to do |
|---|---|---|
422 |
Neither endpoint nor endpoints provided |
Send at least one of the two parameters. |
422 |
More than 50 endpoints in array | Split into multiple requests. |
401 |
Invalid or missing API key | Check your API key in X-API-Key header or api_key param. |
#API Changelog
/cost (single + bulk) and /balance endpoints.