Weav

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.

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

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

Body

urlsarray<string>required
titlestring | null

Maximum length: 255.

agent_idsarray<string> | null
auto_resyncboolean | null

Request

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
}'
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
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
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();

Response

201 Created
{
    "success": true,
    "training_data": {
        "id": "9b2f6c1e-3d4a-4f5b-8c7d-1e2f3a4b5c6d",
        "title": "string",
        "slug": "string",
        "status": "completed"
    },
    "urls_count": 2
}
422 Unprocessable Content
{
    "error": "Error message",
    "code": "ERROR_CODE",
    "errors": {}
}
500 Internal Server Error
{
    "error": "Error message",
    "code": "ERROR_CODE",
    "errors": {}
}
  • 401 Unauthorized

Response fields

successboolean
training_dataobject
urls_countinteger