Chatspark
K

API Reference

v1
K

Authentication

ChatSpark uses API keys for authentication. All requests must include your key in the Authorization header.

API Key Types

Keys are prefixed by mode:

PrefixModeUsage
cs_live_LiveProduction traffic; counts toward your monthly message limit
cs_test_TestDevelopment; separate monthly cap, excluded from analytics

Authorization Header

Include your key in every request using the Bearer scheme:

text

Authorization: Bearer cs_live_...

Key Security Rules

  • Server-side only: Never expose API keys in client-side JavaScript, mobile apps, or public repositories.
  • Store securely: Use environment variables (e.g. CHATSPARK_API_KEY) or a secrets manager.
  • Rotate regularly: Revoke and create new keys periodically. If a key is compromised, revoke it immediately.
Never commit keys to git
Add .env to .gitignore. Use test keys for CI/CD pipelines.

Test Mode

Test keys (cs_test_) have a separate monthly message cap per plan. Messages sent with test keys are excluded from analytics and production metrics.

PlanTest Cap (monthly)
Plus25 messages
Pro100 messages
Enterprise500 messages

Code Examples

curl -X POST https://chatspark.io/api/v1/agents/ag_123/chat \
  -H "Authorization: Bearer cs_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{"message":"Hello"}'

Previous

Quick Start

Next

Rate Limits