API Endpoints

Site Management

API endpoints for site validation, sync, and management.

Validate API Key

Validate an API key and retrieve associated site information.

text
POST /sites/validate

Request

Bash
curl -X POST "https://aioradar.vercel.app/api/sites/validate" \
  -H "Authorization: Bearer aio_sk_your_api_key" \
  -H "Content-Type: application/json"

Response

JSON
{
  "data": {
    "site_id": "550e8400-e29b-41d4-a716-446655440000",
    "domain": "example.com",
    "name": "Example Travel Tours"
  }
}

Error Responses

StatusErrorDescription
401Invalid or missing API keyAPI key not provided or malformed
401API key not foundKey doesn't exist in database

Sync Site Inventory

Synchronize the site's content inventory with AIO Radar. This is typically called after content changes on the WordPress site.

text
POST /sites/sync

Request Body

JSON
{
  "pages": [
    {
      "id": "123",
      "title": "Costa Rica Adventure Tours",
      "url": "https://example.com/costa-rica-tours",
      "type": "page",
      "content_excerpt": "Discover the best adventure tours...",
      "full_content": "Full HTML content...",
      "modified_at": "2024-01-15T10:30:00Z",
      "word_count": 1500,
      "include_in_llm_txt": true
    }
  ],
  "images": [
    {
      "id": "456",
      "url": "https://example.com/images/tour.jpg",
      "alt": "",
      "title": "Tour Image"
    }
  ],
  "markdown": {
    "total_count": 50,
    "pages_with_markdown": 45
  }
}

Request Fields

FieldTypeRequiredDescription
pagesarrayYesArray of page objects
pages[].idstringYesWordPress post ID
pages[].titlestringYesPage title
pages[].urlstringYesFull page URL
pages[].typestringYesPost type (page, post, etc.)
pages[].content_excerptstringNoShort content excerpt
pages[].full_contentstringNoFull page content
pages[].modified_atstringNoISO 8601 date of last modification
pages[].word_countnumberNoWord count of content
pages[].include_in_llm_txtbooleanNoInclude in LLMs.txt (default: true)
imagesarrayNoArray of image objects
images[].idstringYesWordPress attachment ID
images[].urlstringYesImage URL
images[].altstringNoCurrent alt text
images[].titlestringNoImage title
markdownobjectNoMarkdown coverage stats
markdown.total_countnumberYesTotal pages count
markdown.pages_with_markdownnumberYesPages with cached .md files

Response

JSON
{
  "success": true,
  "data": {
    "pages_synced": 50,
    "images_synced": 120,
    "snapshot_id": "snap_abc123"
  }
}

Error Responses

StatusErrorDescription
400Invalid request bodyMissing or malformed fields
401Invalid API keyAuthentication failed

Capture Site Screenshot

Capture or retrieve a screenshot of the site homepage.

text
GET /sites/{id}/screenshot

Returns the current screenshot if available.

text
POST /sites/{id}/screenshot

Captures a new screenshot. Use ?force=true to bypass freshness check.

Request

Bash
# Get current screenshot
curl -X GET "https://aioradar.vercel.app/api/sites/{id}/screenshot" \
  -H "Authorization: Bearer aio_sk_your_api_key"

# Capture new screenshot
curl -X POST "https://aioradar.vercel.app/api/sites/{id}/screenshot?force=true" \
  -H "Authorization: Bearer aio_sk_your_api_key"

Response

JSON
{
  "data": {
    "screenshot_url": "https://cdn.screenshotone.com/...",
    "captured_at": "2024-01-15T10:30:00Z",
    "is_stale": false
  }
}

Query Parameters

ParameterTypeDefaultDescription
forcebooleanfalseForce new capture, bypass freshness check

Notes

  • Screenshots are cached for 30 days
  • A new screenshot is captured automatically if the existing one is stale
  • Screenshots are captured at 1280x720 viewport