Syntext DOCS
Get Started
API Retrain the AI
POST/v1/projects/{projectId}/ai/retrain

Retrain the AI

Rebuilds the AI assistant's knowledge index. Every page from your latest deployed docs is re-chunked and re-embedded, so answers immediately reflect current content.

Retraining happens automatically on every deploy — you normally never need this endpoint. Use it only to force a rebuild (e.g. after a partial index or unexpected answer quality issues).

Path Parameters

The project ID.

Example

curl -X POST "https://api.syntext.dev/v1/projects/prj_abc123/ai/retrain" \
  -H "Authorization: Bearer stx_abc12345_..."

Response

Returns 202 Accepted — retraining runs in the background.

{
  "data": {
    "status": "running",
    "startedAt": "2025-01-15T10:30:00.000Z"
  }
}

Errors

Status Code Meaning
409 already_running A retrain is already in progress for this project.
400 no_deployed_build No deployed build with source available — deploy your docs first.

Poll Retrain Status

curl "https://api.syntext.dev/v1/projects/prj_abc123/ai/retrain" \
  -H "Authorization: Bearer stx_abc12345_..."

Response

{
  "data": {
    "status": "completed",
    "startedAt": "2025-01-15T10:30:00.000Z",
    "finishedAt": "2025-01-15T10:30:42.000Z",
    "pageCount": 38,
    "chunkCount": 214
  }
}

status is one of idle, running, completed, or failed (failures include an error message).

Assistant
Responses are generated using AI and may contain mistakes.

Ask me anything about the documentation.

ESC