Authentication
How to make an API key, send it with each request and keep it safe.
The API uses bearer keys. A key belongs to one account and carries that account's plan limits.
Make a key
- Sign in and open Settings, then Developers.
- Choose Make a key.
- Copy the key. It is shown once, and only the last four characters are kept on screen afterward.
An account has one key at a time. Making a new key stops the old one working at once, so update your code first or have both steps ready.
Send it with every request
Put the key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
curl "https://siz.la/api/account" \
-H "Authorization: Bearer $SIZLA_API_KEY"const response = await fetch("https://siz.la/api/account", {
headers: {
Authorization: `Bearer ${process.env.SIZLA_API_KEY}`,
},
});
const data = await response.json();
console.log(data);import os
import requests
response = requests.get(
"https://siz.la/api/account",
headers={"Authorization": f"Bearer {os.environ['SIZLA_API_KEY']}"},
)
print(response.json())$ch = curl_init('https://siz.la/api/account');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer '.getenv('SIZLA_API_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);A missing, wrong or revoked key gets status 401 and this answer:
{
"error": 1,
"message": "A valid API key is required."
}
Accounts that have been closed get the same answer.
Keep it safe
- Keep the key on your server or in a secret store. Do not put it in a web page, a mobile app or a public repository.
- Read it from an environment variable, as the examples do.
- If it leaks, make a new key. The old one stops working at once.
- Changing the email address or the password through the API also needs the account's current password, so a leaked key alone cannot take an account over.
- Use HTTPS. Requests over plain HTTP are not served.
Keys and the browser
The only call that works without a key is the browser conversion call, which is proved by a click id instead. See (https://siz.la/docs/conversions). Every other call needs a key, so do not call the API from code that runs in a visitor's browser.
AI assistants do not use keys
The assistant connector signs in with OAuth and never sees your key. See (https://siz.la/docs/connector).