Authorization header. Requests without a valid key return a 401 Unauthorized error.
Get an API key
Sign in to app.cline.bot
Go to app.cline.bot and sign in with your Cline account.
Send the key in requests
Include your API key as a Bearer token in theAuthorization header:
curl example
Use an environment variable
Store the key in an environment variable instead of hardcoding it:Use a .env file
Revoke a key
You can delete an API key at any time from Settings > API Keys in app.cline.bot. Deleted keys stop working immediately. You can also manage keys via the API:Optional headers
You can include these optional headers to improve usage tracking and debugging:| Header | Description |
|---|---|
HTTP-Referer | Your application’s URL. Appears in usage logs. |
X-Title | Your application’s name. Appears in usage logs. |
Auth errors
If authentication fails, the API returns a401 HTTP status with this body:
| Error | Cause | Fix |
|---|---|---|
401 Unauthorized | Missing or invalid API key | Check the Authorization header and verify your key at app.cline.bot |
403 Forbidden | Key does not have access to the requested resource | Check key permissions |
402 Payment Required | Account has no remaining credits | Add credits at app.cline.bot |
Security best practices
Do:- Store keys in environment variables or a secrets manager (e.g., AWS Secrets Manager, HashiCorp Vault)
- Use separate keys for development and production
- Rotate keys periodically
- Delete keys you no longer use
- Commit keys to version control
- Share keys in chat, email, or issue trackers
- Embed keys in client-side code (browsers, mobile apps)
- Log keys in application output
Chat completions
Make your first authenticated API request.
Errors
Full list of error codes and how to handle them.