Authentication

Authenticate Your Requests

Learn how to securely authenticate with the ContextStream API.

Obtaining Your API Key

  1. 1.Sign up or log in to your account
  2. 2.Navigate to your dashboard and click on "API Keys"
  3. 3.Click "Create New Key" and give it a descriptive name
  4. 4.Copy your API key immediately — it won't be shown again

Using Your API Key

Include your API key in the Authorization header as a Bearer token:

curl https://api.contextstream.io/api/v1/workspaces \
  -H "Authorization: Bearer cs_live_xxxxxxxxxxxxxxxxxxxx"

Alternatively, you can use the X-API-Key header:

curl https://api.contextstream.io/api/v1/workspaces \
  -H "X-API-Key: cs_live_xxxxxxxxxxxxxxxxxxxx"

API Key Types

Live Keys
cs_live_*

Production keys with full access to your workspaces and data. Use these in your production applications and MCP integrations.

Test Keys
cs_test_*

Development keys that operate in a sandboxed environment. Data created with test keys is isolated and can be safely deleted.

Security Best Practices

Keep Your Keys Secure

Never expose API keys in client-side code, public repositories, or logs.

  • Store API keys in environment variables or secret managers
  • Use different keys for development and production
  • Rotate keys periodically and after any suspected compromise
  • Set up key restrictions by IP or domain when possible
  • Never commit API keys to version control
  • Never include keys in client-side JavaScript

Authentication Errors

401
Unauthorized

The API key is missing or invalid. Check that you're including the header correctly.

403
Forbidden

The API key doesn't have permission for this action. Check your key's scope and workspace access.

Next Steps