> ## 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.

# Process URLs into training data

> Creates URL training data from the provided URLs. In production, URL processing jobs are queued and run asynchronously.

Creates URL training data from the provided URLs. In production, URL processing jobs are queued and run asynchronously.

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

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

## Body

<ParamField body="urls" type="array&lt;string&gt;" required>

</ParamField>

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

<ParamField body="agent_ids" type="array&lt;string&gt; | null">

</ParamField>

<ParamField body="auto_resync" type="boolean | null">

</ParamField>

## Request

<CodeGroup>

```bash cURL
curl --request POST \
  --url 'https://api.weav.com/v1/training-data/url/process' \
  --header "Authorization: Bearer ${WEAV_API_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{
  "urls": [
    "https://example.com"
  ],
  "auto_resync": false
}'
```

```js JavaScript
const body = {
  "urls": [
    "https://example.com"
  ],
  "auto_resync": false
};
const response = await fetch("https://api.weav.com/v1/training-data/url/process", {
  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 = {"urls": ["https://example.com"], "auto_resync": False}
response = requests.post("https://api.weav.com/v1/training-data/url/process", 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/url/process', [
    'headers' => ['Authorization' => 'Bearer '.getenv('WEAV_API_TOKEN')],
    'json' => array (
  'urls' => 
  array (
    0 => 'https://example.com',
  ),
  'auto_resync' => false,
),
]);
echo $response->getBody();
```

</CodeGroup>

## Response

<CodeGroup>

```json 201 Created
{
    "success": true,
    "training_data": {
        "id": "9b2f6c1e-3d4a-4f5b-8c7d-1e2f3a4b5c6d",
        "title": "string",
        "slug": "string",
        "status": "completed"
    },
    "urls_count": 2
}
```

```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="success" type="boolean">

</ParamField>

<ParamField body="training_data" type="object">

</ParamField>

<ParamField body="urls_count" type="integer">

</ParamField>

---

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