Skip to content

Rest API

Ingest a training data source

POST
/api/v1/ai/training/data

Create a new training data source, or update an existing one by passing its trainingDataId. Creating a source of type url starts a website ingestion: Unless crawls the site and trains the AI on its content.

Use cases

  • Ingest a website: Create a url source pointing at the website you want the AI to learn from
  • Rescan: Update an existing source to change its URL filters or schedule and trigger a retrain
  • Add a Q&A: Create a faq source with a question and an answer. Unless trains the AI on it and adds it to the content library

Notes

  • Omit trainingData.trainingDataId to create a new source, pass it to update that source
  • trainingData.accountId and trainingData.websiteId must match the x-account-id and x-website-id headers
  • For website ingestion use type: url with method set to all (crawl the whole site), single (one page) or sitemap
  • For a Q&A use type: faq with method: single, and set question, answer and name. The question and answer together may be at most 1900 characters
  • Ingestion runs asynchronously, poll the get training data endpoint to follow progress
x-api-key
required
string

Your API key from account settings.

x-user-email
required
string

The email address of your user.

x-account-id
required
string

The ID of your account. You can find this in the account settings.

x-website-id
required
string

The ID of the workspace you want to use.

object
trainingData
required
object
trainingDataId

ID of an existing source to update. Omit to create a new source.

string
accountId
required

Must match the x-account-id header.

string
websiteId
required

Must match the x-website-id header.

string
type
required

Kind of source. Use url for website ingestion, other values include faq, pdf, docx, md and csv.

string
method
required

How to crawl a url source. all follows links from the entry point, single ingests one page, sitemap reads the sitemap.

string
Allowed values: single all sitemap
url

Entry point URL for a url source.

string
name

Display name of the source.

string
question

The question of a faq source. Required when creating one.

string
answer

The answer of a faq source. Required when creating one.

string
isPublic
required

Whether content from this source may be shown to anonymous visitors.

boolean
include

Path prefixes to include while crawling.

Array<string>
exclude

Path prefixes to exclude while crawling.

Array<string>
schedule

How often the source is rescanned.

string
Allowed values: Daily Weekly Monthly Never
skipRetrain

Skip retraining after saving, only store the source configuration.

boolean

The source was saved and ingestion was started.

object
message
string
Example
{
"message": "Training data upserted"
}

Unauthorized - invalid API key.