Skip to main content
POST
/
knowledge_graph
/
neo4j
/
website
/
Train Neo4J Website
curl --request POST \
  --url https://rag-prod.studio.lyzr.ai/v4/knowledge_graph/neo4j/website/ \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "urls": [
    "https://example.com"
  ],
  "source": "website",
  "max_crawl_pages": 1,
  "max_crawl_depth": 0,
  "dynamic_content_wait_secs": 5,
  "actor": "apify/website-content-crawler",
  "crawler_type": "cheerio"
}
'
import requests

url = "https://rag-prod.studio.lyzr.ai/v4/knowledge_graph/neo4j/website/"

payload = {
"urls": ["https://example.com"],
"source": "website",
"max_crawl_pages": 1,
"max_crawl_depth": 0,
"dynamic_content_wait_secs": 5,
"actor": "apify/website-content-crawler",
"crawler_type": "cheerio"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
urls: ['https://example.com'],
source: 'website',
max_crawl_pages: 1,
max_crawl_depth: 0,
dynamic_content_wait_secs: 5,
actor: 'apify/website-content-crawler',
crawler_type: 'cheerio'
})
};

fetch('https://rag-prod.studio.lyzr.ai/v4/knowledge_graph/neo4j/website/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://rag-prod.studio.lyzr.ai/v4/knowledge_graph/neo4j/website/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'https://example.com'
],
'source' => 'website',
'max_crawl_pages' => 1,
'max_crawl_depth' => 0,
'dynamic_content_wait_secs' => 5,
'actor' => 'apify/website-content-crawler',
'crawler_type' => 'cheerio'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://rag-prod.studio.lyzr.ai/v4/knowledge_graph/neo4j/website/"

payload := strings.NewReader("{\n \"urls\": [\n \"https://example.com\"\n ],\n \"source\": \"website\",\n \"max_crawl_pages\": 1,\n \"max_crawl_depth\": 0,\n \"dynamic_content_wait_secs\": 5,\n \"actor\": \"apify/website-content-crawler\",\n \"crawler_type\": \"cheerio\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://rag-prod.studio.lyzr.ai/v4/knowledge_graph/neo4j/website/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://example.com\"\n ],\n \"source\": \"website\",\n \"max_crawl_pages\": 1,\n \"max_crawl_depth\": 0,\n \"dynamic_content_wait_secs\": 5,\n \"actor\": \"apify/website-content-crawler\",\n \"crawler_type\": \"cheerio\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://rag-prod.studio.lyzr.ai/v4/knowledge_graph/neo4j/website/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://example.com\"\n ],\n \"source\": \"website\",\n \"max_crawl_pages\": 1,\n \"max_crawl_depth\": 0,\n \"dynamic_content_wait_secs\": 5,\n \"actor\": \"apify/website-content-crawler\",\n \"crawler_type\": \"cheerio\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "Website training complete",
  "rag_id": "6848ff3c4c291b4bef798e0c",
  "pages_trained": 12
}
{
"detail": "Invalid permission"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

x-api-key
string
header
required

Query Parameters

rag_id
string
required

The ID of the RAG system to train

Body

application/json
urls
string[]
required

List of website URLs to crawl

Example:
["https://example.com"]
source
string
required

Data source identifier

Example:

"website"

max_crawl_pages
integer
required

Maximum number of pages to crawl

Example:

1

max_crawl_depth
integer
required

Maximum crawl depth

Example:

0

dynamic_content_wait_secs
integer
required

Time to wait for dynamic content to load (in seconds)

Example:

5

actor
string
required

Apify actor used for crawling

Example:

"apify/website-content-crawler"

crawler_type
string
required

Type of crawler used

Example:

"cheerio"

Response

Website successfully crawled and knowledge graph trained

message
string
Example:

"Website training complete"

rag_id
string
Example:

"6848ff3c4c291b4bef798e0c"

pages_trained
integer
Example:

12