Skip to Content
Peak Solutions

Authentication

Send your API key with every request.

Every request needs your API key. Create one in Dashboard → API keys. Keys start with pk_.

Send the key

Put the key in the X-API-Key header. If your HTTP client prefers it, an Authorization header with a Bearer token works too.

X-API-Key: pk_your_api_key

If you send both, X-API-Key is used.

Check your key

GET /balance is the simplest authenticated call. It costs nothing and tells you what the key can spend. Replace pk_your_api_key with your key.

The Python examples use requests (pip install requests). The Go examples use tls-client (go get github.com/bogdanfinn/tls-client, Go 1.27+).

curl https://api.peak.fo/balance \
  -H "X-API-Key: pk_your_api_key"

If the key works, you get "success": true and your balance. Balance lists every field.

Errors

A key that can't be used is rejected with HTTP 401. error_code says why:

{
  "success": false,
  "error": "invalid API key",
  "error_code": "invalid_api_key"
}
error_codeWhat to do
missing_api_keySend the key in the X-API-Key header.
invalid_api_keyCheck for typos, or copy the key again from the dashboard.
api_key_inactiveThe key was turned off, or its package expired or ran out.
account_suspendedContact support.
auth_errorWe couldn't check the key. Retry.

Keep your key secret

Anyone with your key can spend your balance.

Only use your key on a server

Never put it in a browser, a mobile app, or a public repository. Load it from an environment variable or a secrets manager.

If a key leaks, click Rotate key in Dashboard → API keys. You can rotate a key once an hour. The old key stops working within a few seconds.

On this page