API Reference
Update an existing agent's configuration. Only the fields you include in the request body will be modified. Requires Pro plan or higher.
/api/v1/agents/{id}
Pro+| Name | Type | Required | Description |
|---|---|---|---|
| id | integer | Required | The agent ID |
All fields are optional. Only include the fields you want to update.
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Internal agent name | |
| botName | string | Display name shown in the chat widget | |
| botPersonality | string | System prompt / personality instructions | |
| botNoAnswer | string | Fallback message when the agent cannot answer | |
| welcomeMessage | string | Initial greeting message | |
| websiteUrl | string | Associated website URL | |
| primaryColor | string | Widget accent color (hex) | |
| removeBranding | boolean | Remove ChatSpark branding | |
| gaID | string | Google Analytics 4 measurement ID |
bash
curl -X PATCH https://chatspark.io/api/v1/agents/42 \
-H "Authorization: Bearer cs_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"botName": "Support Bot",
"botPersonality": "You are a friendly support assistant.",
"primaryColor": "#3182CE"
}'json
{
"agent": {
"id": 42,
"name": "My Agent",
"botName": "Support Bot",
"botPersonality": "You are a friendly support assistant.",
"websiteUrl": "https://example.com",
"status": "listed",
"updatedAt": "2026-02-23T14:30:00.000Z"
}
}javascript
const response = await fetch('https://chatspark.io/api/v1/agents/42', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer cs_live_abc123...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
botName: 'Support Bot',
primaryColor: '#3182CE',
}),
});
const { agent } = await response.json();
console.log(agent.botName); // "Support Bot"