Own prepaid credit balance
get_credit_balanceCheck the authenticated key's prepaid credit balance before metered calls and verify top-ups landed, preventing insufficient-credit failures.
Instructions
Call this BEFORE a batch of metered calls to confirm the calling key's prepaid credit balance covers it, and AFTER a 402 INSUFFICIENT_CREDITS + human top-up to verify the funds landed. The balance is ALWAYS the authenticated key's own — no parameters, so reading another key's balance is structurally impossible. Returns api_key_id (non-secret UUID), balance_ore (whole øre, always an integer), currency (NOK), updated_at (null = never topped up = balance 0), and top_up_url (hand it to a human; agents cannot pay directly). For affordability, multiply cost_ore from get_pricing by the planned call count and compare against balance_ore. Free (unmetered), zero side effects. Failure modes: 401 without a key (NOT keyless — use get_pricing for keyless price discovery); SCOPE_INSUFFICIENT (needs read:credits or read:*); CREDIT_BALANCE_UNAVAILABLE (503, retryable — a money read is never fabricated). Under a sandbox bearer it returns SANDBOX_TOOL_UNAVAILABLE. Docs: https://www.apier.no/docs/guides/agent-payments
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| _meta | No | ||
| result | Yes | The authenticated key's own prepaid balance: api_key_id, balance_ore, currency, updated_at, top_up_url. | |
| metadata | Yes | ||
| justification | Yes |