Chatspark
K

API Reference

v1
K

Update Agent

Update an existing agent's configuration. Only the fields you include in the request body will be modified. Requires Pro plan or higher.

PATCH

/api/v1/agents/{id}

Pro+

Path Parameters

NameTypeRequiredDescription
idintegerRequired

The agent ID

Request Body

All fields are optional. Only include the fields you want to update.

NameTypeRequiredDescription
namestring

Internal agent name

botNamestring

Display name shown in the chat widget

botPersonalitystring

System prompt / personality instructions

botNoAnswerstring

Fallback message when the agent cannot answer

welcomeMessagestring

Initial greeting message

websiteUrlstring

Associated website URL

primaryColorstring

Widget accent color (hex)

removeBrandingboolean

Remove ChatSpark branding

gaIDstring

Google Analytics 4 measurement ID

Example Request

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"
  }'

Example Response

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"
  }
}

Node.js Example

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"

Previous

Get Agent

Next

Create Agent