Borga authenticates every API request using API keys. You include your secret key in theDocumentation Index
Fetch the complete documentation index at: https://docs.borga.is/llms.txt
Use this file to discover all available pages before exploring further.
Authorization header of each request. Requests without a valid key are rejected before they reach any endpoint. There are two key types — one for server-side calls and one for browser-side flows — and you should never mix them up.
Key types
Borga issues two distinct key types, each with a different scope and environment variant.| Key prefix | Type | Where to use |
|---|---|---|
sk_live_… | Secret — live mode | Server-side only. Processes real charges. |
sk_test_… | Secret — test mode | Server-side only. No real charges. |
pk_live_… | Publishable — live mode | Browser-side embedded checkout only. |
pk_test_… | Publishable — test mode | Browser-side embedded checkout only. |
Passing your secret key
Include your secret key as a Bearer token in theAuthorization header of every request:
curl
Merchant ID header
Most Borga endpoints require anX-Merchant-Id header identifying which merchant account the request is for. Your Merchant ID has the format mer_… and is visible in the dashboard under Settings → API Keys.
You can also retrieve it programmatically:
curl
The
GET /v1/merchants/current endpoint does not require the X-Merchant-Id header — it infers the merchant from the API key itself. Use it to look up your Merchant ID during initial setup.Idempotency
Network failures can leave you uncertain whether a request was processed. To safely retry aPOST request without risking duplicate charges, include an Idempotency-Key header with a unique string (a UUID works well). Borga stores the result of the first request and returns the same response for any subsequent requests with the same key, without executing the operation again.
curl
Test vs. live mode
The key prefix determines the mode of every request:sk_test_…— test mode. No real charges are made. Card numbers, payments, and invoices are all simulated. Use this during development and staging.sk_live_…— live mode. Requests process real ISK charges immediately.
Authentication errors
| HTTP status | Meaning | What to do |
|---|---|---|
401 Unauthorized | The Authorization header is missing, malformed, or contains an invalid key. | Verify the key is correct, has not been rotated, and is being passed as Bearer sk_… in the header. |
403 Forbidden | The key is valid but does not have permission to perform this action. | Check that you are using a secret key (not a publishable key) for server-side calls, and that the key has the required scopes. |
401 response body looks like this:
error.message field for a human-readable explanation before contacting support.