API Reference
Create a new agent. Requires the agents:write scope and Enterprise plan. Use Idempotency-Key header for safe retries.
/api/v1/agents
Enterprise| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Display name for the agent |
| botName | string | Bot name shown to users. Defaults to name | |
| botPersonality | string | System prompt / personality | |
| websiteUrl | string | Associated website URL |
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"
}
}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"}'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();