Agentic Scraper

API Reference

One endpoint, two modes. Authenticate once, scrape anything.

Quick Start

Base URL

https://api.scrapx.io/

Get your API key from app.scrapx.io → Settings → API.

Authentication

Pass your API key in the x-api-key header. No Workspace ID needed.

curl -X POST https://api.scrapx.io/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "agentTask": { ... }
  }'

Rate Limiting

Requests are counted per workspace per calendar day (UTC). The limit is configured in your workspace settings (maxAPIRequest, default 1000).

Response HeaderDescription
x-api-ratelimit-limitMax requests per day
x-api-ratelimit-remainingRequests remaining today
x-api-ratelimit-resetUnix timestamp of next midnight UTC

When the limit is exceeded the API returns 429 Too Many Requests.

Mode 1 — Agentic

Send a plain-text prompt. The AI agent launches a real browser, renders JavaScript, and returns a screenshot, raw HTML, or a data extract. No URL field, no credentials — just describe what you need.

Request body

FieldTypeDescription
agentTask.goalstringRequired. Plain-language task — include the URL in your prompt, e.g. "Go to shop.example.com and extract all product names and prices"
agentTask.maxStepsnumberMax browser actions (default 10)
agentTask.outputstringai_extract | text | html | markdown | screenshot
agentTask.urlstringOptional starting URL. Alternatively include the URL directly in goal
agentTask.credentialsobjectKey/value pairs for login fields, e.g. {"username": "...", "password": "..."}. The agent fills in matching fields automatically

Example — extract product prices

curl -X POST https://api.scrapx.io/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "agentTask": {
      "goal": "Go to shop.example.com/products and extract all product names and prices"
    }
  }'

Example — screenshot a JS-rendered page

curl -X POST https://api.scrapx.io/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "agentTask": {
      "goal": "Go to dashboard.example.com, wait for the charts to load, and take a screenshot",
      "output": "screenshot"
    }
  }'

Mode 2 — Command

Define exact browser steps. No AI per-step cost. Perfect for stable, well-known page structures.

Step types

ActionFieldsDescription
navigateurlGo to URL
clickselectorClick element (CSS selector or visible text)
typeselector, valueType text into input
waitmsWait milliseconds
extractselector, multiple?, attribute?, as?Extract text or attribute from element(s). as sets the key in the result
screenshotas?Full-page screenshot — returns an S3 URL (30-day TTL)
scrolldirection?, amount?Scroll up or down by px
evaluateexpression, as?Run custom JS in page context

returnType options

json (default) — returns all extract results as an object · text / html / markdown — final page content · screenshot — last screenshot taken, returned as an S3 URL (30-day TTL)

Example — search and extract results

curl -X POST https://api.scrapx.io/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "commandTask": {
      "url": "https://example.com",
      "steps": [
        { "action": "type", "selector": "input[name=q]", "value": "scrapx" },
        { "action": "wait", "ms": 1500 },
        { "action": "extract", "selector": "h3.result-title", "multiple": true, "as": "titles" },
        { "action": "extract", "selector": ".price", "multiple": true, "as": "prices" },
        { "action": "screenshot", "as": "final" }
      ],
      "returnType": "json"
    }
  }'

Response Format

Agentic mode — AI extract (200)

{
  "requestId": "uuid",
  "output": {
    "status": "success",
    "steps": 4,
    "result": { "data": "Product A: $12.99, Product B: $8.49", "format": "ai_extract" },
    "usage": { "promptTokens": 4200, "completionTokens": 80, "totalTokens": 4280, "estimatedCostUsd": 0.0011 },
    "sessionUrl": "https://...s3.amazonaws.com/.../response.json",
    "videoUrl": "https://...s3.amazonaws.com/.../agent-session.webm"
  }
}

Agentic mode — screenshot (200)

{
  "requestId": "uuid",
  "output": {
    "status": "success",
    "steps": 2,
    "result": { "data": "https://...s3.amazonaws.com/.../screenshot.png", "format": "screenshot" },
    "usage": { "promptTokens": 3100, "completionTokens": 42, "totalTokens": 3142, "estimatedCostUsd": 0.0008 },
    "sessionUrl": "https://...s3.amazonaws.com/.../response.json",
    "videoUrl": "https://...s3.amazonaws.com/.../agent-session.webm"
  }
}

Command mode (200)

{
  "requestId": "uuid",
  "output": {
    "status": "success",
    "steps": 3,
    "extractions": {
      "titles": ["Product A", "Product B"],
      "prices": ["$12.99", "$8.49"],
      "final": "https://...s3.amazonaws.com/.../screenshot-0.png"
    },
    "returnType": "json",
    "sessionUrl": "https://...s3.amazonaws.com/.../response.json"
  }
}

Error

{ "error": "Invalid API key" }
{ "error": "Rate limit exceeded", "limit": 1000, "used": 1001, "reset": 1716681600 }
{ "error": "Missing agentTask or commandTask in request body" }

Response Headers

HeaderDescription
x-api-request-idUnique ID for this request (use for support)
x-api-workspace-idWorkspace ID used
x-api-ratelimit-limitDaily request limit
x-api-ratelimit-remainingRemaining requests today
x-api-ratelimit-resetUnix timestamp of next reset (midnight UTC)
x-api-versionAPI version

Error Codes

CodeMeaning
400Bad request — missing or invalid body
401Unauthorized — missing or invalid API key
429Rate limit exceeded — check x-api-ratelimit-reset
500Internal error — task execution failed

Usage Endpoint

Check today's usage without executing a task.

GET https://api.scrapx.io/usage
x-api-key: YOUR_API_KEY

// Response
{
  "limit": 1000,
  "used": 47,
  "remaining": 953,
  "reset": 1716681600
}