K-OTP

Get wallet balance

GET /v1/balance

GET https://api.k-otp.dev/v1/balance

Overview

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 keysRequired scopeAlso accepted
sk_otp:balance*

Response (200)

Current wallet balance.

FieldTypeRequiredDescription
appIdstringyes
balancenumberyesCurrent balance as a credit quantity (not money).
currencystringyesUnit of balance; currently always CREDIT.
updatedAtstringyesWhen the wallet last changed (RFC 3339).

Error responses

Every error uses the { defined, code, status, message, data? } envelope. See Errors.

StatuscodeDescription
400BAD_REQUESTthe request failed input validation. message describes the first failing constraint.
401UNAUTHORIZEDthe Authorization: Bearer credential is missing, malformed, inactive, or rejected by introspection.
403FORBIDDENthe credential lacks otp:balance (or an accepted alias), or a pk_ public key was used. Public keys are limited to issue/verify.
409CONFLICTthe request conflicts with the current state of the resource.
500INTERNAL_SERVER_ERRORunexpected server failure. Undefined errors (defined: false) use the same envelope.
503SERVICE_UNAVAILABLEcredential 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"

On this page