Skip to main content

Overview

The webhook endpoint allows external systems to notify the llms.txt generator when a website’s content has changed, triggering an immediate recrawl. This is useful for keeping llms.txt files synchronized with content management systems, CI/CD pipelines, or other automated workflows. Unlike the scheduled cron endpoint, this webhook triggers a recrawl for a specific site immediately.

Endpoint

Authentication

Webhooks support optional per-site authentication via webhook secrets:
  • If a webhook_secret is configured for the site in the database, it must be provided in the request
  • If no secret is configured, the webhook can be called without authentication (not recommended for production)
string
Optional secret token for authenticating webhook calls. Must match the webhook_secret stored in the database for the given site.

Request

string
required
The base URL of the site to recrawl. Must match a site enrolled in the auto-update system.Example: "https://docs.example.com"
string
Authentication secret (required only if configured for this site in the database).

Example Request

Response

Success Response (200)

string
Always "scheduled" when the recrawl is successfully queued.
string
The base URL that was scheduled for recrawl (echoed from request).
string
ISO 8601 timestamp when the recrawl will be processed. Set to current time for immediate processing.

Error Responses

Site Not Enrolled (404)

Returned when the base_url is not found in the crawl_sites table.
Solution: The site must first be crawled with enableAutoUpdate: true via the WebSocket endpoint.

Invalid Webhook Secret (401)

Returned when the provided webhook_secret doesn’t match the stored value.

Database Unavailable (503)

Returned when Supabase connection fails.

Internal Error (500)

Returned for unexpected server errors.

How It Works

1. Validation

The endpoint performs these checks:
  1. Database connectivity: Ensures Supabase is available
  2. Site enrollment: Verifies base_url exists in crawl_sites table
  3. Secret validation: If a secret is stored, validates the provided secret matches

2. Scheduling

If validation passes:
  1. Sets next_crawl_at to current timestamp (immediate processing)
  2. Updates updated_at timestamp
  3. Returns confirmation

3. Processing

The actual recrawl happens when:
  • The scheduled cron job runs (checks for sites with next_crawl_at <= NOW())
  • This webhook sets next_crawl_at to now, so the site will be picked up on the next cron run
The webhook schedules a recrawl but doesn’t execute it immediately. The cron job must be running to process scheduled recrawls.

Integration Examples

Mintlify CI/CD

Next.js API Route

Vercel Deploy Hook

WordPress Plugin

Security Configuration

Setting Up Webhook Secrets

Webhook secrets are stored per-site in the crawl_sites table:
Generate secure webhook secrets:

Security Best Practices

  1. Always use webhook secrets in production
  2. Generate unique secrets per site if hosting multiple sites
  3. Use HTTPS for all webhook calls
  4. Rotate secrets periodically
  5. Store secrets securely (environment variables, secret managers)
  6. Validate webhook source in your CI/CD pipeline

Database Schema

Relevant fields in the crawl_sites table:

Error Codes

Rate Limiting

No explicit rate limits are enforced on this endpoint. However:
  • Multiple calls for the same site will update next_crawl_at each time
  • The cron job processes sites sequentially, so only one recrawl happens at a time
  • Consider implementing rate limiting in your webhook caller to avoid excessive requests

Monitoring

Check database to verify webhook calls:

Comparison with Cron Endpoint

Best Practices

  1. Enroll sites first: Use WebSocket endpoint with enableAutoUpdate: true
  2. Set webhook secrets: Always configure secrets for production sites
  3. Call after deploy: Trigger webhook after content is published, not before
  4. Handle errors: Implement retry logic for failed webhook calls
  5. Monitor database: Check next_crawl_at is updated correctly
  6. Run cron frequently: Ensure cron job runs often enough to pick up webhook triggers

Troubleshooting

Webhook Returns 404 “Site not enrolled”

Cause: The site hasn’t been crawled with auto-update enabled. Solution: Crawl the site via WebSocket with enableAutoUpdate: true:

Webhook Returns 401 “Invalid webhook secret”

Cause: The provided secret doesn’t match the database value. Solution: Check the stored secret:

Recrawl Not Happening After Webhook

Cause: Cron job not running or running infrequently. Solution:
  1. Verify cron job is scheduled and running
  2. Check next_crawl_at was updated:
  3. Check cron job logs for errors