Chatspark
K

API Reference

v1
K

Create Agent

Create a new agent. Requires the agents:write scope and Enterprise plan. Use Idempotency-Key header for safe retries.

POST

/api/v1/agents

Enterprise

Request Body

NameTypeRequiredDescription
namestringRequired

Display name for the agent

botNamestring

Bot name shown to users. Defaults to name

botPersonalitystring

System prompt / personality

websiteUrlstring

Associated website URL

Response Schema (201 Created)

json

{
  "agent": {
    "id": 124,
    "name": "New Support Bot",
    "botName": "New Support Bot",
    "websiteUrl": "https://example.com",
    "status": "listed",
    "createdAt": "2025-02-24T12:00:00.000Z"
  }
}

cURL

bash

curl -X POST "https://chatspark.io/api/v1/agents" \
  -H "Authorization: Bearer cs_live_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: unique-key-123" \
  -d '{"name":"New Support Bot","websiteUrl":"https://example.com"}'

Node.js

javascript

const res = await fetch(`${API_BASE}/agents`, {
  method: "POST",
  headers: {
    "Authorization": "Bearer cs_live_...",
    "Content-Type": "application/json",
    "Idempotency-Key": "unique-key-123",
  },
  body: JSON.stringify({
    name: "New Support Bot",
    websiteUrl: "https://example.com",
  }),
});
const { agent } = await res.json();

Previous

Update Agent

Next

Delete Agent