Overview
The API uses WebSockets for real-time bidirectional communication, allowing you to:- Send crawl requests with custom parameters
- Receive real-time progress updates
- Get the generated llms.txt content
- Retrieve hosted CDN URLs
Authentication
The API supports two authentication methods:- JWT Token (Recommended)
- API Key (Direct)
Generate a short-lived token from the Response:
/auth/token endpoint.1
Request a token
cURL
Tokens are valid for 5 minutes (300 seconds).
2
Connect with token
WebSocket Connection
Setting Up API Key
Configure authentication in your backend.env file:
.env
Generate Key
WebSocket Endpoint
URL:wss://your-backend.com/ws/crawl
Query Parameters:
token(string, optional): JWT authentication tokenapi_key(string, optional): Direct API key authentication
One authentication method (token or api_key) is required unless API_KEY is not configured in the backend.
Request Format
After establishing the WebSocket connection, send a JSON payload to initiate crawling:Message Schema
string
required
The base URL of the website to crawl. Must include protocol (http:// or https://).Example:
"https://example.com"integer
default:50
Maximum number of pages to crawl.Range: 1-200Example:
50integer
default:500
Character limit for page description excerpts.Range: 100-2000Example:
500boolean
default:false
Enable scheduled recrawls for this site.Requires Supabase configuration.
integer
default:10080
Minutes between scheduled recrawls (default: 7 days).Only used when
enableAutoUpdate is true.boolean
default:false
Enable LLM-powered content enhancement.Requires
LLM_ENHANCEMENT_ENABLED=true in backend config.boolean
default:true
Use Brightdata proxy for JavaScript rendering.Falls back to the backend’s
BRIGHTDATA_ENABLED setting if not specified.Example Request
Response Format
The server sends JSON messages with atype and content field:
Message Types
string
Progress updates and informational messages.
string
The complete generated llms.txt content.
string
The public CDN URL where the llms.txt file is hosted.
string
Error messages when something goes wrong.
Implementation Examples
JavaScript/TypeScript
Python
Python Client
Error Handling
Connection Errors
Server-Side Errors
The server sends error messages withtype: "error":
Error Message
"Failed to fetch <url>: Connection timeout"- Target site is unreachable"Invalid URL format"- URL validation failed"Max pages must be between 1 and 200"- Invalid parameter"Crawl interrupted"- Unexpected crawl termination
Rate Limiting
Client-side rate limiting example:Rate Limiting
Testing
Using wscat
Test the WebSocket API from the command line:Install wscat
Connect and Send
Health Check
Verify the backend is running:Health Endpoint
Next Steps
Configuration
Learn about all environment variables and settings
Web Interface
Use the user-friendly web UI instead of the API
API Reference
View the complete API specification
Deployment
Deploy your own instance