Balance
GET /balance returns what your API key can spend.
GET https://api.peak.fo/balance
Returns your balance, or what's left on your package. It's free, so it's also the easiest way to check that a key works.
Request
| Header | Value |
|---|---|
X-API-Key | Your API key. |
curl https://api.peak.fo/balance \
-H "X-API-Key: pk_your_api_key"For examples in Python, JavaScript and Go, see Authentication.
Response
The fields in data depend on how the key is billed.
Pay-per-solve key. Each successful solve is taken from your balance.
| Field | Type | Description |
|---|---|---|
data.type | string | pay_per_solve |
data.balance | number | Your account balance, in USD. |
Package key. Solves come out of the package instead of your balance.
| Field | Type | Description |
|---|---|---|
data.type | string | package |
data.package_name | string | The package's name. |
data.remaining_solves | number | Solves left. |
data.total_solves | number | Solves the package started with. |
data.allowed_tasks | string[] | The task_type values this key can solve, or ["all"]. A Turnstile package covers both Turnstile task types. |
data.expires_at | string | When the package expires, as an ISO 8601 time. |
data.days_remaining | number | Whole days until it expires. |
{
"success": true,
"data": {
"type": "pay_per_solve",
"balance": 12.5
}
}Errors
error_code | HTTP | What to do |
|---|---|---|
missing_api_key | 401 | Send the key in the X-API-Key header. |
invalid_api_key | 401 | Check for typos, or copy the key again from the dashboard. |
api_key_inactive | 401 | The key was turned off, or its package expired or ran out. |
account_suspended | 401 | Your account is suspended. Contact support. |
auth_error | 401 | We couldn't check the key. Retry. |
internal_error | 500 | Something went wrong on our side. Retry. |