v1

REST API Documentation

Complete programmatic access to SiteGulp. Manage sites, start crawls, retrieve results, and configure webhooks via our REST API.

Quick Start

1Get Your API Key

Generate an API key from your Settings page. Keep it secure - it provides full access to your account.

2Make Your First Request

Include your API key in the Authorization header with every request.

cURL Example
curl -X GET "https://your-domain.com/api/v1/sites" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

3Create a Site and Start Crawling

Create a Site
curl -X POST "https://your-domain.com/api/v1/sites" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Website",
    "url": "https://example.com",
    "maxPages": 100
  }'
Start a Crawl
curl -X POST "https://your-domain.com/api/v1/sites/SITE_ID/crawls" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Initial Crawl",
    "prompt": "Explore all main pages and capture screenshots"
  }'

Authentication

All API requests require authentication via Bearer token in the Authorization header:

Authorization: Bearer ak_your_api_key_here

Rate Limiting

1,000 requests per hour per API key

Secure Keys

Keys are hashed with SHA-256 and never stored in plain text

Keep It Secret

Your API key provides full access to your account. Never expose it in client-side code.

API Endpoints

Sites

GET
/api/v1/sites
POST
/api/v1/sites
GET
/api/v1/sites/:siteId
PUT
/api/v1/sites/:siteId
DELETE
/api/v1/sites/:siteId

Crawls

GET
/api/v1/sites/:siteId/crawls
POST
/api/v1/sites/:siteId/crawls
GET
/api/v1/crawls/:crawlId
DELETE
/api/v1/crawls/:crawlId

Results

GET
/api/v1/crawls/:crawlId/results
GET
/api/v1/crawls/:crawlId/pages
GET
/api/v1/crawls/:crawlId/artifacts
GET
/api/v1/crawls/:crawlId/logs

Webhooks

GET
/api/v1/sites/:siteId/webhooks
POST
/api/v1/sites/:siteId/webhooks
GET
/api/v1/webhooks/:webhookId
PUT
/api/v1/webhooks/:webhookId
DELETE
/api/v1/webhooks/:webhookId
POST
/api/v1/webhooks/:webhookId/test

Webhooks

Webhook Events

Subscribe to events to receive real-time notifications when crawls change state.

crawl.startedFired when a crawl begins execution
crawl.completedFired when a crawl finishes successfully
crawl.failedFired when a crawl encounters an error
crawl.cancelledFired when a crawl is cancelled
*Subscribe to all events

Webhook Payload

Example payload sent when a crawl completes

{
  "event": "crawl.completed",
  "timestamp": "2025-11-30T06:00:00.000Z",
  "data": {
    "crawlId": "abc123",
    "projectId": "xyz789",
    "projectName": "My Website",
    "projectUrl": "https://example.com",
    "crawlName": "Initial Crawl",
    "status": "completed",
    "pagesFound": 50,
    "screenshotsTaken": 50,
    "scriptsGenerated": 25,
    "duration": 120000,
    "completedAt": "2025-11-30T06:02:00.000Z"
  }
}

Webhook Signatures

Verify webhook authenticity using HMAC-SHA256 signatures

Every webhook includes a signature header for verification:

X-SiteGulp-Signature: t=1732946400,v1=abc123...

Verify the signature by computing HMAC-SHA256 of the timestamp and payload using your webhook secret.

Node.js Verification Example
const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const [timestampPart, signaturePart] = signature.split(',');
  const timestamp = timestampPart.split('=')[1];
  const receivedSignature = signaturePart.split('=')[1];

  const signedPayload = `${timestamp}.${JSON.stringify(payload)}`;
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(signedPayload)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(receivedSignature),
    Buffer.from(expectedSignature)
  );
}

Response Format

{
  "success": true,
  "data": {
    "id": "site_abc123",
    "name": "My Website",
    "url": "https://example.com",
    "createdAt": "2025-11-30T06:00:00.000Z"
  },
  "meta": {
    "apiKey": "Production Key"
  }
}

Ready to Get Started?

Generate your API key and start automating your website crawls today.

Get Your API Key
API Documentation | SiteGulp | SiteGulp