Chatspark
K

API Reference

v1
K

Quick Start

Make your first API call in under 5 minutes.

Step 1: Generate an API key

Go to your API Keys dashboard (/my/api), create a new key, and copy it. You will only see the full key once. Store it securely.

Use cs_live_... for production or cs_test_... for testing. See Authentication for details.

Step 2: Send your first chat request

Replace {agentId} with your agent ID (found in your agent settings or the URL) and cs_live_... with your API key.

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

Step 3: Read the response

A successful response returns the AI reply and conversation metadata.

json

{
  "reply": "Hi! How can I help you today?",
  "conversationId": "conv_abc123",
  "messageId": "msg_xyz789"
}

Response fields:

NameTypeRequiredDescription
replystringRequired

The AI agent's response text

conversationIdstringRequired

ID for continuing this conversation

messageIdstringRequired

ID of the assistant message

Next steps

  1. Authentication - API key types, security, and test mode
  2. Chat API - Full request parameters and streaming
  3. Streaming - Stream responses token-by-token for real-time UX

Previous

Overview

Next

Authentication