Authentication
Key format, headers, signup from a script and account endpoints.
Every request to a model carries the account key in one of two headers. Both work on both endpoints.
Authorization: Bearer ak_...
x-api-key: ak_...If both are present, Authorization is used. GET /v1/models needs no key.
Keys
- A key is
ak_followed by 40 lowercase hex characters. - One account has one key. The key is the account. There is no username, email or password.
- We store only a SHA-256 hash of the key and a short hint made of its first and last characters.
- The key is shown once at signup. We cannot show it again, reset it or recover it.
- Anyone who has the key can spend the balance. Keep it out of client-side code and public repositories.
Getting a key
The simple way is /signup in a browser. The same two steps work from a script:
# 1. Create the account. The key is returned once and cannot be shown again.
curl -X POST https://veil.st/api/signup
# {"key":"ak_<40 hex characters>"}
# 2. Activate it by sending the key back. Do this within one hour.
curl -X POST https://veil.st/api/session \
-H "Content-Type: application/json" \
-d '{"key":"ak_..."}'
# {"ok":true}A new account is pending until the key is sent back once. A pending key gets 403 account_inactive from the API. Pending accounts that are not activated within one hour are deleted.
Signup is limited across the whole service, not per caller, because we do not look at who is calling. If it returns 429, wait a minute.
Browser sessions
Signing in on the website sets one cookie named session. It is HttpOnly and SameSite=Strict, holds a signed account id and lasts 30 days. API clients do not need it.
Account endpoints
These take the key as a Bearer token and return plain JSON. Their errors have the shape {"error":"message"}, which is different from the model endpoints.
| Endpoint | What it does |
|---|---|
GET /api/account | Balance, open holds, limits and usage for the last 30 days. |
POST /api/topups | Creates a Monero invoice. Body: {"usd": 10}. |
GET /api/topups | Lists the last 20 invoices. |
GET /api/topups/{id} | One invoice with its status and confirmations. |
DELETE /api/account | Deletes the account and everything tied to it. Any balance is forfeited. |