Get wallet balance
GET /v1/balance
GET https://api.k-otp.dev/v1/balanceOverview
Returns the current credit wallet balance for the authenticated app. balance is a credit quantity (not money) and currency is CREDIT. Reading the balance never affects OTP issue status.
Requires an sk_ secret key; pk_ public keys are rejected with 403.
Authentication
| Accepted keys | Required scope | Also accepted |
|---|---|---|
sk_ | otp:balance | * |
Response (200)
Current wallet balance.
| Field | Type | Required | Description |
|---|---|---|---|
appId | string | yes | |
balance | number | yes | Current balance as a credit quantity (not money). |
currency | string | yes | Unit of balance; currently always CREDIT. |
updatedAt | string | yes | When the wallet last changed (RFC 3339). |
Error responses
Every error uses the { defined, code, status, message, data? } envelope. See Errors.
| Status | code | Description |
|---|---|---|
| 400 | BAD_REQUEST | the request failed input validation. message describes the first failing constraint. |
| 401 | UNAUTHORIZED | the Authorization: Bearer credential is missing, malformed, inactive, or rejected by introspection. |
| 403 | FORBIDDEN | the credential lacks otp:balance (or an accepted alias), or a pk_ public key was used. Public keys are limited to issue/verify. |
| 409 | CONFLICT | the request conflicts with the current state of the resource. |
| 500 | INTERNAL_SERVER_ERROR | unexpected server failure. Undefined errors (defined: false) use the same envelope. |
| 503 | SERVICE_UNAVAILABLE | credential introspection or a downstream dependency is temporarily unavailable. Retry with backoff. |
Example request
curl "https://api.k-otp.dev/v1/balance" \
-H "Authorization: Bearer $KOTP_SECRET_KEY"