Chatspark
K

API Reference

v1
K

Add Training Source

Add a new training source (text, URL, or full website) to an agent. Use type text with data, or page/website with url. Requires Enterprise plan.

Endpoint

POST https://chatspark.io/api/v1/agents/{id}/training

Request Body

FieldTypeRequiredDescription
sourcestringYesUnique identifier for this source (e.g., slug)
typestringYesOne of: text, page, website
datastringFor textRaw text content (required when type is text)
urlstringFor page/websiteURL to scrape (required when type is page or website)

Response Schema (201 Created)

{
  "source": {
    "id": 1,
    "source": "product-docs",
    "type": "text",
    "trainingUrl": null,
    "title": null,
    "status": "pending",
    "dataCount": null,
    "createdAt": "2026-02-24T12:00:00.000Z",
    "updatedAt": "2026-02-24T12:00:00.000Z"
  }
}

Code Examples

curl -X POST "https://chatspark.io/api/v1/agents/ag_123/training" \
  -H "Authorization: Bearer cs_live_..." \
  -H "Content-Type: application/json" \
  -d '{"source":"faq","type":"text","data":"Q: What are your hours? A: 9am-5pm Mon-Fri."}'

Previous

List Sources

Next

Delete Source