> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lusor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Scrape

> Read one screen of a phone app and get it back as Markdown, JSON fields and screenshots.

Scrape opens an app on a phone, follows an `app://` address to one screen, and returns that screen as a document: Markdown, the fields you ask for as JSON, and screenshots. It reads the whole page, scrolling to its end.

Scrape is mechanical. Fixed rules follow the address: open the app, tap the row each part of the path names, and check that the screen moved on. No model chooses where to go. If the screen does not match the address, the scrape fails and names the step. Only the `json` format uses a model, to read fields off the page.

For work that needs judgment, such as signing in, searching or filling a form, use [Agent](https://docs.lusor.ai/app-data/agent.md). To find the addresses an app has, use [Map](https://docs.lusor.ai/app-data/map.md). To keep working on the screen a scrape ended on, send it a turn with [Interact](https://docs.lusor.ai/app-data/interact.md).

> [!NOTE]
>
> Lusor's app-data API is modeled on Firecrawl's: the same call names and result shapes where they fit, with changes where phones need them. A screen is an `app://` address instead of a URL. A scrape is a task you read back by id, because reading a phone screen takes seconds. Tasks queue per phone, because a phone runs one task at a time. Map lists the screens earlier runs recorded, plus base maps Lusor ships, since an app has no sitemap. [Firecrawl's calls, for phone apps](https://lusor.ai/blog/firecrawl-calls-for-phone-apps) goes through every difference.

## Scrape a screen

A scrape is a task. Start it with `POST /v1/scrape`, then read it with `GET /v1/scrape/{id}`.

```bash theme={null}
curl https://api.lusor.ai/v1/scrape \
  -H "X-Api-Key: $LUSOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "app://settings/general/about",
    "formats": ["markdown"]
  }'
```

The request returns `202` with the task's id at once:

```json theme={null}
{
  "id": "3f6c1e0a-…",
  "liveViewUrl": "https://…"
}
```

Read the task until its `status` is no longer `processing`. `$TASK_ID` is the `id` the start call returned:

```bash theme={null}
curl "https://api.lusor.ai/v1/scrape/$TASK_ID" \
  -H "X-Api-Key: $LUSOR_API_KEY"
```

### Response

A completed scrape returns the document:

```json theme={null}
{
  "status": "completed",
  "markdown": "# About\n- **Name**: iPhone\n- **iOS Version**: 26.1\n- **Model Name**: iPhone 13 Pro Max\n- **Model Number**: …",
  "metadata": {
    "scrapeId": "3f6c1e0a-…",
    "url": "app://settings/general/about",
    "sourceURL": "app://settings/general/about",
    "title": "About",
    "app": "com.apple.Preferences",
    "device": "…",
    "screensRead": 2,
    "reachedEnd": true,
    "durationMs": 9500
  },
  "error": null
}
```

| Field | What it is |
| - | - |
| `markdown` | The page as Markdown: its title as `# Title`, then one line per row, top to bottom. A row with a value is `- **Name**: value`, a row without one is `- **Name**`. Each row appears once, even when it was on two screens. |
| `json` | The fields you asked for. See [Extract fields as JSON](#extract-fields-as-json). |
| `screenshot`, `screenshots` | Pictures of the page. See [Screenshots](#screenshots). |
| `metadata.scrapeId` | The task id. |
| `metadata.sourceURL` | The address you sent, as written. |
| `metadata.url` | The address of the screen the read ended on. A scrape that does not reach its address fails, so a completed scrape answers the address it followed. |
| `metadata.title` | The screen's title, when the read found one. |
| `metadata.app` | The app's package or bundle id, when the read named one. |
| `metadata.device` | The phone the scrape ran on. |
| `metadata.screensRead` | How many screens of the page were read. |
| `metadata.reachedEnd` | `true` when the read reached the end of the page, `false` when `maxScreens` stopped it first. |
| `metadata.durationMs` | How long the read took, in milliseconds. |
| `metadata.unverified` | The `json` fields whose value the page did not show. Present only when there are some. |
| `metadata.creditsUsed` | The credits this scrape was charged. Phone minutes on a Lusor Phone are billed apart. See [Credits and minutes](https://docs.lusor.ai/billing/credits-and-minutes.md). |
| `metadata.concurrencyLimited`, `metadata.concurrencyQueueDurationMs` | Present when the scrape waited for its phone. See [A busy phone queues the scrape](#a-busy-phone-queues-the-scrape). |

## Addresses

An address is one string in Lusor's own scheme, the way a web page has a URL:

```
app://settings/general/about
```

* **The host is the app.** Write a Lusor app name, such as `settings`, `photos`, `messages`, `safari` or `calendar`, and Lusor opens that app on the phone's platform. Or write the app's own package or bundle id, such as `app://com.apple.Preferences/general/about`, and Lusor opens it as written.
* **The path is the screens to tap through.** Each part is a row's name as it appears on screen, in lowercase with dashes: "Software Update" is `software-update`. Parts match the names on screen ignoring case, and a dash matches a space.
* **`app://settings` alone** reads the app's first screen.

Scrape follows the path from the app's first screen. If the app was left on another page, Lusor taps back until it reaches the first screen or a screen on the address's path, then follows the rest. A step that is not on screen is found by scrolling the list. A name that matches two rows taps nothing and fails the scrape, listing the matches.

Scrape follows `app://` addresses only. Any other address, including a deep link such as `instagram://…` or a web link, is refused with `400 bad_request`.

## Formats

`formats` says what comes back. Without it, a scrape returns `["markdown"]`.

| Format | Returns |
| - | - |
| `"markdown"` | `markdown`, the page as Markdown. |
| `"screenshot"` | `screenshot`, a picture of the screen the address reached. |
| `{ "type": "screenshot", "fullPage": true }` | `screenshot`, plus `screenshots`: one picture for each screen read, top to bottom. |
| `{ "type": "json", "schema": { … } }` | `json`, the fields the schema names, read off the page. |

Any other format is refused with `400 unsupported_format`, and the message names the supported ones.

### Extract fields as JSON

Send a JSON Schema whose top-level properties are plain values: `string`, `number`, `integer` or `boolean`.

```bash theme={null}
curl https://api.lusor.ai/v1/scrape \
  -H "X-Api-Key: $LUSOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "app://settings/general/about",
    "formats": [
      "markdown",
      {
        "type": "json",
        "schema": {
          "type": "object",
          "properties": {
            "version": { "type": "string" },
            "model": { "type": "string" }
          }
        }
      },
      "screenshot"
    ]
  }'
```

```json theme={null}
{
  "status": "completed",
  "markdown": "# About\n- **Name**: iPhone\n…",
  "json": { "version": "26.1", "model": "iPhone 13 Pro Max" },
  "screenshot": "https://…",
  "metadata": { "scrapeId": "3f6c1e0a-…", "url": "app://settings/general/about", "…": "…" },
  "error": null
}
```

Every text and number value is checked against the page's own text. A value the page does not show comes back as `null`, and the field is listed in `metadata.unverified`: a missing value is safer than a wrong one. A field the model could not read is `null` too. Booleans describe the state of the screen rather than words on it, so they are not checked.

A schema with a nested object, an array or no `properties` is refused with `400 unsupported_schema`, and the message names the property. For nested results, or results that need judgment, use [Agent](https://docs.lusor.ai/app-data/agent.md) with a schema. [Structured output](https://docs.lusor.ai/agents/structured-output.md) explains how to write one.

### Screenshots

`screenshot` is a PNG of the screen the address reached, taken before the page is scrolled. With `fullPage: true`, `screenshots` holds one PNG for each screen read. They are separate pictures, not one stitched image.

Each picture is usually an `https` link, valid for 24 hours from the read and never past the moment the result leaves your plan's history. Read the task again for fresh links. A picture that could not be stored comes back inline, as a `data:image/png;base64,…` URL.

A scrape that asks only for `screenshot` reads one screen and does not scroll.

## Read the whole page

After it reaches the address, scrape scrolls the page to its end and returns all of it. Each move scrolls a whole screen: the last row shown in full becomes the first row of the next screen.

`maxScreens` caps how far it reads, the first screen included. It defaults to `10` and can be at most `50`. `"maxScreens": 1` reads only the screen the address reaches.

```bash theme={null}
curl https://api.lusor.ai/v1/scrape \
  -H "X-Api-Key: $LUSOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "app://settings/privacy-&-security",
    "formats": ["markdown", { "type": "screenshot", "fullPage": true }],
    "maxScreens": 20
  }'
```

`metadata.screensRead` says how many screens were read. `metadata.reachedEnd` is `false` when `maxScreens` stopped the read first, so rows may be left below. A page that does not scroll is one screen.

## Start and status

Every scrape is a task: it holds a phone for a few seconds or more, so the request returns at once and you read the result when it is ready.

| Step | Request | Returns |
| - | - | - |
| Start | `POST /v1/scrape` | `202` with `id`, and `liveViewUrl` when the run can be watched. |
| Status | `GET /v1/scrape/{id}` | `status`, then the document or `error`. |

`status` is one of:

| Status | Meaning |
| - | - |
| `processing` | The scrape is waiting for its phone, working, or writing its result. Keep reading. |
| `completed` | The document is in the response. |
| `failed` | `error` says why, including the step of the address the screen did not match. |
| `cancelled` | The scrape was stopped. |

The first read that says `completed` carries the document, and the first that says `failed` carries the `error`, so you can stop at the first status that is not `processing`.

A failed scrape names the step that did not match, counting from `0`:

```json theme={null}
{
  "status": "failed",
  "error": "step 1 (\"abuot\") is not on this screen or in 2 page moves up and down the list: nothing is named \"abuot\""
}
```

The task id is also the id of its session, so `GET /v1/sessions/{id}` describes the same run. See [Follow a session](https://docs.lusor.ai/agents/follow-a-session.md).

### Watch it run

While the scrape runs, `liveViewUrl` is a watch-only link to the phone: a player page you can open or embed with no Lusor login. Taps and typing through it are refused, and it stops working when the scrape ends. Send `expiresIn` (seconds) in the body, or as a query parameter on the status read, to make the link expire sooner. The response leaves `liveViewUrl` out once the run has ended, or when the phone cannot serve one.

### A busy phone queues the scrape

A phone runs one task at a time. A scrape sent to a phone that is running another task waits, reading `processing`, and starts when the phone frees. Its `metadata` then reports `concurrencyLimited: true` and `concurrencyQueueDurationMs`, the time from your request to the phone taking it. A scrape that found the phone free has neither field.

A scrape still waiting after 15 minutes fails with `queue_expired`, without starting, and is not charged.

### Retry safely

Send an `Idempotency-Key` header with a value you choose. A retry with the same key returns the first request's task id instead of starting a second scrape.

## Options

| Field | Required | Meaning |
| - | - | - |
| `url` | Yes | The address, up to 2,048 characters. See [Addresses](#addresses). |
| `formats` | No | What to return. Defaults to `["markdown"]`, at most 16 entries. See [Formats](#formats). |
| `maxScreens` | No | The most screens to read, `1` to `50`. Defaults to `10`. |
| `device` | When the workspace has more than one phone | The id of the phone to run on. A workspace with one phone uses it. |
| `workspaceId` | No | The workspace, for a credential that can reach several. An API key is bound to one workspace and can leave it out. |
| `expiresIn` | No | Shortens the live view link, in seconds. |

Scrape takes no `actions` list. A request that includes `actions` is refused with `400 bad_request` before anything runs. To tap, type or move around an app, use [Agent](https://docs.lusor.ai/app-data/agent.md). Other fields scrape does not know are ignored.

## Errors

Errors are JSON with an `error` code and a `message`. See [Errors](https://docs.lusor.ai/billing/errors.md).

| Status | `error` | Meaning |
| - | - | - |
| `400` | `bad_request` | The body is invalid: `url` is missing or not an `app://` address, `maxScreens` is out of range, or the request includes `actions`. Nothing ran. |
| `400` | `unsupported_format` | A format scrape does not return. The message lists the supported ones. |
| `400` | `unsupported_schema` | The `json` schema has a field that is not a plain value, or no `properties`. The message names the field. |
| `400` | `device_required` | The workspace has several phones and the request did not name one. `devices` lists their ids. |
| `400` | `no_device` | The workspace has no phone. |
| `400` | `unknown_device` | `device` is not one of the workspace's phones. `devices` lists their ids. |
| `401` | `unauthenticated`, `invalid_api_key` | The API key is missing, wrong or revoked. |
| `402` | `credits_exhausted` | The workspace is out of credits. Nothing ran. |
| `404` | `not_found` | On `GET`: no task with this id in the key's workspace. |
| `429` | `device_busy` | The phone is being updated and cannot take a task yet. Try again shortly. A phone that is running another task queues the scrape instead. |
| `502` | `no_document` | On `GET`: the scrape finished without a document. Start it again. |

## Known limits

* **An address is the words on screen.** It works on the platform and in the language those words come from. Scrape has been tested mostly on English iPhone Settings. One address that works across platforms and languages is not built yet.
* **A step below the fold is slower.** To prove a name is unique, scrape scans the whole list before it taps a row that was not on the first screen.
* **A page opened from the app's own search** (for example Settings, then search, then a result) can make the next scrape of that app fail, because the read can start from the wrong page.
* **`json` over a longer page reads the text alone.** On a one-screen page, the fields are read from the text and the screenshot. When more than one screen is read, only the text is used, so a value the page shows only as a picture is not found.
* **No `actions`, and no other formats yet.** `summary`, `links`, `images` and the other Firecrawl formats are refused with `unsupported_format`.

## Related

> [card] [Map](https://docs.lusor.ai/app-data/map.md)
>
> List the addresses Lusor knows for an app, then scrape them.

> [card] [Agent](https://docs.lusor.ai/app-data/agent.md)
>
> Give a task in plain words when you do not know which screen holds the data.

> [card] [Interact](https://docs.lusor.ai/app-data/interact.md)
>
> Keep working on the screen this task ended on.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.