Authentication
Every call except listing and reading operations needs an API key. Send it as a Bearer token in the Authorization header.
On this page
Authorization: Bearer filesokay_…For example, to get the credits your Workspace can spend:
curl https://api.filesokay.com/v1/credits \
-H "Authorization: Bearer $FILESOKAY_KEY"const res = await fetch("https://api.filesokay.com/v1/credits", {
headers: {
Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
},
});
const balance = await res.json();import os
import requests
res = requests.get(
"https://api.filesokay.com/v1/credits",
headers={
"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
},
)
balance = res.json(){
"available_credits": 1908
}Keys are read only from this header, never from the address, because addresses end up in logs.
- In your Workspace, open Settings, then API keys.
- Select Create API key, and give the key a name you’ll recognise later.
- Confirm it’s you. The key is shown once: copy it and store it somewhere safe.
Admins and Members can both create keys, unless an Admin has turned off Members can create API keys. Each person can have up to 25 active keys in a Workspace. If you lose a key, revoke it and create a new one.
- It acts in its own Workspace, which pays for the jobs it starts.
- It sees the files and jobs made with any of its Workspace’s API keys, so a new key carries on where a replaced one stopped.
- Keep keys on your server. Never put one in a web page, a mobile app or a code repository.
- Read the key from an environment variable or a secrets manager, as the examples do with
FILESOKAY_KEY. - Use a separate key for each app, so you can revoke one without stopping the others.
In Settings, then API keys, select Revoke beside the key. It stops working from the next request. Members can revoke their own keys, and Admins any key in the Workspace.
| Status | Code | Meaning |
|---|---|---|
| 401 | unauthorized | The key is missing, unknown or revoked. |
| 402 | subscription_required | The key’s Workspace has no active subscription. |
{
"code": "unauthorized",
"detail": "Send a valid API key as a Bearer token.",
"request_id": "5e6f235c2bfcaceb5e4d07a2a1ab3dbb",
"status": 401,
"title": "Unauthorized",
"type": "about:blank"
}