API Reference
ChatSpark uses API keys for authentication. All requests must include your key in the Authorization header.
Keys are prefixed by mode:
| Prefix | Mode | Usage |
|---|---|---|
cs_live_ | Live | Production traffic; counts toward your monthly message limit |
cs_test_ | Test | Development; separate monthly cap, excluded from analytics |
Include your key in every request using the Bearer scheme:
text
Authorization: Bearer cs_live_...CHATSPARK_API_KEY) or a secrets manager..env to .gitignore. Use test keys for CI/CD pipelines.Test keys (cs_test_) have a separate monthly message cap per plan. Messages sent with test keys are excluded from analytics and production metrics.
| Plan | Test Cap (monthly) |
|---|---|
| Plus | 25 messages |
| Pro | 100 messages |
| Enterprise | 500 messages |
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"}'