docs/api/authentication.mdx
Every request to the Cline API requires authentication via a Bearer token in the Authorization header.
There are two ways to authenticate:
| Method | Use case | How to get it |
|---|---|---|
| API key | Direct API calls, scripts, CI/CD | Create at app.cline.bot Settings > API Keys |
| Account auth token | Cline extension and CLI | Generated automatically when you sign in |
Both methods use the same header format:
Authorization: Bearer YOUR_TOKEN
API keys are the recommended authentication method for programmatic access.
You can revoke an API key at any time from the same Settings > API Keys page. Deleted keys stop working immediately.
You can also manage keys programmatically through the Enterprise API:
# List your keys
curl https://api.cline.bot/api/v1/api-keys \
-H "Authorization: Bearer YOUR_TOKEN"
# Delete a key
curl -X DELETE https://api.cline.bot/api/v1/api-keys/KEY_ID \
-H "Authorization: Bearer YOUR_TOKEN"
When you sign in to the Cline extension (VS Code, JetBrains) or CLI, an account auth token is generated and managed automatically. You do not need to handle these tokens manually.
The Cline CLI uses these tokens when you authenticate via:
# Interactive sign-in
cline auth
# Or quick setup with an API key
cline auth -p cline -k "YOUR_API_KEY" -m anthropic/claude-sonnet-4-6
See the CLI Reference for all auth options.
Do:
Do not:
# Set the key
export CLINE_API_KEY="your_api_key_here"
# Use it in requests
curl -X POST https://api.cline.bot/api/v1/chat/completions \
-H "Authorization: Bearer $CLINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "anthropic/claude-sonnet-4-6", "messages": [{"role": "user", "content": "Hello"}]}'
# .env (add to .gitignore)
CLINE_API_KEY=your_api_key_here
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.cline.bot/api/v1",
api_key=os.environ["CLINE_API_KEY"],
)
The Cline API accepts optional headers for tracking and identification:
| Header | Description |
|---|---|
HTTP-Referer | Your application's URL. Helps with usage tracking. |
X-Title | Your application's name. Appears in usage logs. |
X-Task-ID | A unique task identifier. Used internally by the Cline extension. |