Skip to main content
Every request to the Cline API must include a valid API key in the Authorization header. Requests without a valid key return a 401 Unauthorized error.

Get an API key

1

Sign in to app.cline.bot

Go to app.cline.bot and sign in with your Cline account.
2

Open API Keys

Navigate to Settings > API Keys.
3

Create and copy your key

Click Create API Key. Copy it immediately — you cannot view it again after leaving this page.
Treat your API key like a password. Do not commit it to version control or share it publicly.

Send the key in requests

Include your API key as a Bearer token in the Authorization 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:

Auth errors

If authentication fails, the API returns a 401 HTTP status with this body:
Common causes and fixes:

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
Do not:
  • 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.