Skip to content

Extract

Ask for the fields you want and get them back as JSON. A model reads the page we already fetched, so there is no parser to write and no HTML to look at.

One call

POST /v1/scrape
curl -X POST https://api.scrapa.app/v1/scrape \
  -H "authorization: Bearer sc_live_your_key" \
  -H "content-type: application/json" \
  -d '{
    "url": "https://example.com/produto/1",
    "formats": ["extract"],
    "extract": {
      "schema": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "price": { "type": "number" },
          "inStock": { "type": "boolean" }
        }
      }
    }
  }'
The answer
{
  "data": {
    "url": "https://example.com/produto/1",
    "finalUrl": "https://example.com/produto/1",
    "status": 200,
    "engine": "fetch",
    "pool": "residential",
    "bytes": 48213,
    "extract": {
      "name": "Cafeteira italiana 6 xícaras",
      "price": 149.9,
      "inStock": true
    },
    "metadata": { "title": "Cafeteira italiana 6 xícaras", "contentType": "text/html" }
  }
}

Put extract in formats, say which fields you want, and the answer carries them. It is the same scrape it always was (same engines, same exits, same refusals) with one more thing in it.

A sentence instead of a schema

extract.prompt
{
  "url": "https://blog.example.com/post",
  "formats": ["extract"],
  "extract": { "prompt": "the author, the date it was published and the three main points" }
}

A schema pins the shape. When you do not have one yet, say what you want in plain words and the model picks the shape. Send both when a field needs explaining: prompt is where you say that the price you mean is the one after the discount.

What the page did not say

A field the page does not carry comes back null. That is the promise the whole feature rests on: a hole you can check for beats a plausible number you cannot.

And when the model itself does not answer (it refuses, it runs out of time, it writes something that is not JSON), extract is null, that credit goes back, and the page you asked for still answers.

It reads; it does not count

Ask for the prices on a page and you get the prices. Ask for their total and you get a number that looks right and often is not. We measured it here on a twenty-item list, where two different models each returned a confident sum and both were wrong. Pull the fields out and add them up in your own code, where the arithmetic is arithmetic.

The shell spelling

GET /v1/scrape
curl "https://api.scrapa.app/v1/scrape?url=https://example.com/produto/1&format=extract&extractPrompt=the+name+and+the+price" \
  -H "authorization: Bearer sc_live_your_key"

?format=extract&extractPrompt=… carries the words half from a terminal. A JSON Schema stays in the POST body, where it is written as JSON instead of percent-encoded into a URL nobody can read.

What it costs

Five credits on top of whichever engine read the page: six in all for a plain fetch, ten when the page needed a browser. It is charged with the page, not after, so a quote tells you the number before you spend it.

A page the site blocked costs nothing, extraction included: there was no page to read. If your own browser.actions script ran in it first, you pay the browser price and its bandwidth, and get the 5 extraction credits back.