Authentication
The OctaSpace API authenticates requests with an API key of your account. The same key works for the REST API, the SDKs and the CLI.
API keys
An API key starts with octa_ak_, for example octa_ak_4f9c.... It acts on behalf of your account: it can read your balance and sessions, start sessions that are charged to your balance and change the prices of the nodes you host.
Create a key
- Sign in to the OctaSpace dashboard.
- In the sidebar, open Account → Credentials.
- In the API Keys section, click New key.
- Enter a Label that tells you where the key is used, for example billing-service or ci-runner, and click Create key.
- Copy the key.
The API Keys list shows each key's label, its first characters and when it was last used. The number of keys per account is limited; the counter next to API Keys shows how many you have.
Delete a key
Delete a key under Account → Credentials → API Keys. Every program that uses it stops working at once and gets 401 Invalid bearer token.
Sending the key
Send the key in the Authorization header with the Bearer scheme:
GET /accounts/balance HTTP/1.1
Host: api.octa.space
Authorization: Bearer octa_ak_...curl -s https://api.octa.space/accounts/balance \
-H "Authorization: Bearer $OCTA_API_KEY"The SDKs and the CLI add the header for you:
Tool | Where the key goes |
|---|---|
Go SDK | octaspace.NewClient(os.Getenv("OCTA_API_KEY")) |
JavaScript SDK | new OctaClient({ apiKey: process.env.OCTA_API_KEY }) |
CLI | octa auth <key> once; the key is saved to ~/.config/octa/config.yaml (owner-only permissions) |
octa auth status shows which key (masked) and which API host the CLI uses, and whether the key works.
Requests without a key
Some endpoints are public. Without a key they return the same data, but some are cached longer:
Endpoint | Without a key |
|---|---|
GET /network, /network/history | Same result |
GET /stats/gpu/current, /stats/gpu/history, /stats/gpu/locations, /stats/mining | Same result |
GET /services/compute, /services/render, /services/vpn (machine listings) | Refreshed about once an hour instead of at most every 10 seconds |
GET /compute/apps | Official apps only, without your own |
Every other endpoint requires a key and returns 401 Missing bearer token without one. Requests without a key also have a lower rate limit: 60 per minute per IP address.
Keeping keys safe
- Never put a key in source code or version control. Read it from an environment variable or a secret store (GitHub Actions secrets, Vault, your cloud's secret manager).
- Never ship a key in a browser bundle or a mobile app. Anyone who opens the page can read it. In a public web app, call the API from your backend. Keys in the browser are fine only for trusted internal tools.
- One key per program or machine. If one leaks, you delete it without touching the others, and the "last used" time shows which program is active.
- Do not log the Authorization header. The SDKs never log the key, but if you add your own request logging, leave the headers out.
- Avoid shell history. Read the key without echoing it:
read -rs OCTA_API_KEY && export OCTA_API_KEYIf a key leaks, delete it right away and create a new one. Then check Marketplace → Sessions for sessions you did not start.