The Authorization header
Send your key in the Authorization header with the Key scheme on every request:
Header
Authorization: Key pk_prev_your_key_herecurl "https://inferlane.net/api/v1/models" \
-H "Authorization: Key $API_KEY"Wrong header format
A header in any other form, such as Bearer, is rejected with 401 so integration mistakes show up early:
401 Unauthorized
{
"error": {
"type": "unauthorized",
"message": "Authorization header must look like \"Key YOUR_API_KEY\"."
}
}Keys in the preview
Any value in the Key form is accepted, and requests without the header are accepted too, so the playground works before you create a key. Send the header anyway: production keys will be required.
Preview keys are created and stored in your browser on this device. They are not valid anywhere else.
Keep keys on the server
- Call the API from your backend or a serverless function, never from code that ships to browsers or apps.
- Read the key from an environment variable or a secret manager. Do not commit it.
- Use one key per app or environment so you can revoke one without touching the rest. See Managing API keys.