> ## Documentation Index
> Fetch the complete documentation index at: https://docs.weav.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create training data

> Create training data. Supports multiple types: text, url, file, video, qa. Processing happens automatically in the background.

Create training data. Supports multiple types: text, url, file, video, qa. Processing happens automatically in the background.

```http
POST https://api.weav.com/v1/training-data
```

Requires a token with the `external-api:write` ability.

## Body

<ParamField body="type" type="string" required>
One of: `text`, `url`, `file`, `video`, `qa`.
</ParamField>

<ParamField body="content" type="string">
Required for type='text'
</ParamField>

<ParamField body="url" type="string">
Required for type='url'

Format: `url`.
</ParamField>

<ParamField body="file" type="file">
Required for type='file' (multipart/form-data)

Format: `binary`.
</ParamField>

<ParamField body="video_url" type="string">
Required for type='video'

Format: `url`.
</ParamField>

<ParamField body="question" type="string">
Required for type='qa'
</ParamField>

<ParamField body="answer" type="string">
Required for type='qa'
</ParamField>

<ParamField body="title" type="string | null">
Maximum length: 255.
</ParamField>

<ParamField body="description" type="string | null">

</ParamField>

<ParamField body="agent_ids" type="array&lt;string&gt; | null">
Array of agent UUIDs to attach this training data to
</ParamField>

## Request

<CodeGroup>

```bash cURL
curl --request POST \
  --url 'https://api.weav.com/v1/training-data' \
  --header "Authorization: Bearer ${WEAV_API_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "text",
  "content": "Your text content here",
  "url": "https://example.com",
  "video_url": "https://youtube.com/watch?v=...",
  "question": "What is your return policy?",
  "answer": "Our return policy allows returns within 30 days."
}'
```

```js JavaScript
const body = {
  "type": "text",
  "content": "Your text content here",
  "url": "https://example.com",
  "video_url": "https://youtube.com/watch?v=...",
  "question": "What is your return policy?",
  "answer": "Our return policy allows returns within 30 days."
};
const response = await fetch("https://api.weav.com/v1/training-data", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEAV_API_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(body)
});
console.log(await response.json());
```

```python Python
import os
import requests

headers = {"Authorization": f"Bearer {os.environ['WEAV_API_TOKEN']}"}
body = {"type": "text", "content": "Your text content here", "url": "https://example.com", "video_url": "https://youtube.com/watch?v=...", "question": "What is your return policy?", "answer": "Our return policy allows returns within 30 days."}
response = requests.post("https://api.weav.com/v1/training-data", headers=headers, json=body)
print(response.json())
```

```php PHP
use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('POST', 'https://api.weav.com/v1/training-data', [
    'headers' => ['Authorization' => 'Bearer '.getenv('WEAV_API_TOKEN')],
    'json' => array (
  'type' => 'text',
  'content' => 'Your text content here',
  'url' => 'https://example.com',
  'video_url' => 'https://youtube.com/watch?v=...',
  'question' => 'What is your return policy?',
  'answer' => 'Our return policy allows returns within 30 days.',
),
]);
echo $response->getBody();
```

</CodeGroup>

## Response

<CodeGroup>

```json 201 Created
{
    "id": "9b2f6c1e-3d4a-4f5b-8c7d-1e2f3a4b5c6d",
    "type": "text",
    "source": "string",
    "title": "string",
    "description": "string",
    "slug": "string",
    "is_processed": false,
    "status": "queued",
    "training_folder_id": "9b2f6c1e-3d4a-4f5b-8c7d-1e2f3a4b5c6d",
    "created_at": "2026-01-01T00:00:00Z",
    "updated_at": "2026-01-01T00:00:00Z"
}
```

```json 400 Bad Request
{
    "error": "Error message",
    "code": "ERROR_CODE",
    "errors": {}
}
```

```json 422 Unprocessable Content
{
    "error": "Error message",
    "code": "ERROR_CODE",
    "errors": {}
}
```

```json 500 Internal Server Error
{
    "error": "Error message",
    "code": "ERROR_CODE",
    "errors": {}
}
```

</CodeGroup>

- `401` Unauthorized

## Response fields

<ParamField body="id" type="string">
Format: `uuid`.
</ParamField>

<ParamField body="type" type="string">
One of: `text`, `url`, `file`, `video`, `qa`.
</ParamField>

<ParamField body="source" type="string">

</ParamField>

<ParamField body="title" type="string | null">

</ParamField>

<ParamField body="description" type="string | null">

</ParamField>

<ParamField body="slug" type="string | null">

</ParamField>

<ParamField body="is_processed" type="boolean">

</ParamField>

<ParamField body="status" type="string | null">
One of: `queued`, `processing`, `completed`, `failed`.
</ParamField>

<ParamField body="training_folder_id" type="string | null">
Format: `uuid`.
</ParamField>

<ParamField body="created_at" type="string | null">
Format: `date-time`.
</ParamField>

<ParamField body="updated_at" type="string | null">
Format: `date-time`.
</ParamField>

---

This knowledge base is built and hosted on [Weav](https://weav.com).
