> ## 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.

# Read one screen of an app

> Opens an app, follows an `app://` address to a screen, and returns
that screen as a document. The task is a session: the id is the
session id, so `GET /v1/scrape/{id}` answers its status and document.

It is mechanical: fixed rules follow the address (open the app, tap
the row each path part names, confirm the screen moved on), and no
model chooses a target. A path part the screen does not carry fails
the task with that step named, rather than guessing or reading a
different screen. Only the `{type: "json", schema}` format asks a
model to read fields off the screen.

The phone is the workspace's only phone when it has one. A workspace
with several phones passes `device`; without it the request is a
`400` that lists the ids to choose from. A task holds its phone for
its duration. A phone already running another task queues this one:
it reads `processing` and starts when the phone frees, and its document's
`metadata` then reports `concurrencyLimited` and
`concurrencyQueueDurationMs`. A task still waiting after 15 minutes
fails with `queue_expired` without starting, and nothing is charged.
Phone time is charged as it is for a run.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/scrape
openapi: 3.1.0
info:
  title: Lusor API
  version: 0.1.0
  description: |
    Run AI agents on real phones, or drive a phone directly with
    deterministic actions.

    ## Authentication

    Every `/v1/*` endpoint except `GET /v1/health` requires an API key.
    Create one in the Lusor dashboard under **Settings → API Keys**. A key
    is shown once and is bound to one workspace. Revoking it there stops it
    working immediately.

    Send it in either header:

    - `X-Api-Key: <your API key>`
    - `Authorization: Bearer <your API key>`

    Because a key is bound to its workspace, `workspaceId` query and body
    parameters are optional for API-key callers. A request that names a
    different workspace returns an opaque `404`.

    ## Runs

    `POST /v1/agent` runs one task on a phone and returns its id; read the
    result with `GET /v1/agent/{id}`.

    To keep a conversation with an agent instead, use
    `POST /v1/agents/{id}/turns` to start or continue an agent run.
    Read the run under `/v1/sessions/{id}`; poll
    `GET /v1/sessions/{id}/status` or `GET /v1/sessions/{id}/events` for
    progress.

    ## Errors

    Errors are JSON: `{ "error": "<code>", "message": "<text>" }`. A
    request that fails validation returns `400` in one of two shapes,
    depending on the endpoint: `{ "error": "validation_error", "details":
    { ... } }` (direct phone control actions, for example), or
    `{ "error": "bad_request", "message": "<text>" }` (agent endpoints, for
    example). Branch on `error`.
  contact:
    name: Lusor
    url: https://lusor.ai
  license:
    name: Proprietary
    url: https://lusor.ai/terms
servers:
  - url: https://api.lusor.ai
    description: Production
security:
  - ApiKey: []
  - BearerAuth: []
tags:
  - name: Agent
    description: |
      One call runs a task on a phone and returns its result: the answer
      as `data` (text, or the object a schema describes) and the run's
      recording.
  - name: Scrape
    description: |
      One call reads one screen of an app: the screen as Markdown, fields
      read off it, and its picture.
  - name: Interact
    description: |
      Keep working on the screen an agent or scrape task left open, then
      stop.
  - name: Map
    description: |
      List an app's known screens as `app://` addresses, from the screens
      earlier runs passed through. Never walks a phone.
  - name: Agents
    description: Persistent agents, the phone each one uses, and their turns (runs).
  - name: Secrets
    description: |
      Secrets saved in a workspace (passwords, sign-in details). A run uses
      them by name through `secrets`; values never travel in a request.
  - name: Sessions
    description: |
      Run records: list, inspect, stop, and read events and artifacts. Start
      a run with `POST /v1/agents/{id}/turns`, or without an agent through
      `POST /v1/workspaces/{workspaceId}/devices/{deviceId}/sessions`.
  - name: LiveView
    description: |
      View-only WebRTC live view of a session's phone: signaling, ICE
      servers, and stream control. API keys get live view only on the
      customer's own phone, not on a Lusor Phone.
  - name: Devices
    description: |
      The phones in your workspace, and reads of their current screen and
      UI tree.
  - name: DeviceVerbs
    description: |
      Direct phone control: deterministic actions (tap, swipe, type, key,
      clear, back, home, recent, screenshot, apps/start, apps/stop) and
      chains of them. On a Lusor Phone, API-key calls meter phone minutes.
  - name: Shell
    description: |
      Restricted shell escape hatch. Commands are checked against a
      denylist and audit-logged. No command output is returned.
  - name: Datasets
    description: Lists a run produced, saved as reusable Datasets.
  - name: Skills
    description: Reusable automation skills (Markdown documents).
  - name: PhoneNumbers
    description: |
      Workspace phone numbers and their stored SMS messages. Read-only for
      API keys.
  - name: Emails
    description: >
      Workspace Agent Mail addresses and stored inbound mail. Addresses

      are added and removed through a quote (billed to the workspace's

      Inbox plan). Mail is read-only: there is no compose, reply, or send
      endpoint, and message

      bodies are returned as raw plain text without HTML execution, remote

      asset fetches, or code extraction.
  - name: Workspaces
    description: The workspace an API key is bound to.
  - name: Billing
    description: The account's plan and the credits it has left.
  - name: Catalog
    description: The catalog of apps that can be installed on a Lusor Phone.
  - name: AppInstalls
    description: |
      Install catalog apps on a phone, follow the installs, and uninstall
      them. Viewers cannot install.
  - name: Notifications
    description: |
      Notifications the workspace's phones forward, the apps each phone
      forwards, and the rules that act on them. Read-only for API keys.
  - name: Files
    description: Files the workspace's agents saved from its phones. Read-only.
  - name: ModelKeys
    description: |
      The workspace's own OpenAI or Anthropic API key, used by its runs
      instead of Lusor's (paid plans).
  - name: Health
    description: Service health check.
paths:
  /v1/scrape:
    post:
      tags:
        - Scrape
      summary: Read one screen of an app
      description: >
        Opens an app, follows an `app://` address to a screen, and returns

        that screen as a document. The task is a session: the id is the

        session id, so `GET /v1/scrape/{id}` answers its status and document.


        It is mechanical: fixed rules follow the address (open the app, tap

        the row each path part names, confirm the screen moved on), and no

        model chooses a target. A path part the screen does not carry fails

        the task with that step named, rather than guessing or reading a

        different screen. Only the `{type: "json", schema}` format asks a

        model to read fields off the screen.


        The phone is the workspace's only phone when it has one. A workspace

        with several phones passes `device`; without it the request is a

        `400` that lists the ids to choose from. A task holds its phone for

        its duration. A phone already running another task queues this one:

        it reads `processing` and starts when the phone frees, and its
        document's

        `metadata` then reports `concurrencyLimited` and

        `concurrencyQueueDurationMs`. A task still waiting after 15 minutes

        fails with `queue_expired` without starting, and nothing is charged.

        Phone time is charged as it is for a run.
      operationId: startScrape
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScrapeTaskInput'
      responses:
        '202':
          description: Task accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScrapeTaskStarted'
        '400':
          description: |
            A request-validation refusal (`bad_request`, including a `url`
            that is not an `app://` address), a phone that could not be
            chosen (`device_required`, `no_device`, `unknown_device`, each
            listing `devices`), a format this step does not answer yet
            (`unsupported_format`, which names the supported ones), or a json
            schema whose fields are not plain values (`unsupported_schema`,
            which names the property).
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/AgentDeviceError'
                  - $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/TenantPaused'
        '429':
          description: |
            The phone is being updated and cannot take a task yet
            (`device_busy`); try again shortly. A phone running another task
            queues the task instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Busy'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      schema:
        type: string
        maxLength: 256
      description: |
        Caller-provided key for safe retries. The same key in the same
        workspace yields the same run id, and a duplicate POST within the
        retention window returns the original run instead of starting a
        second one.
  schemas:
    ScrapeTaskInput:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          maxLength: 2048
          description: |
            The screen's address: `app://<app>/<path>`, the host a Lusor app
            name (`settings`) or a raw package / bundle id
            (`com.apple.Preferences`), the path each screen's name in lowercase
            with dashes (`app://settings/general/about`). Only `app://`
            addresses are followed today: any other address, a deep link or
            a web link included, is a `400 bad_request`.
        formats:
          type: array
          maxItems: 16
          description: |
            What to return. Defaults to `["markdown"]`. Supported in this
            step: `markdown`, `screenshot` (or `{type: "screenshot",
            fullPage: true}`), and `{type: "json", schema}`; anything else
            is a `400 unsupported_format`.
          items:
            $ref: '#/components/schemas/ScrapeFormat'
        maxScreens:
          type: integer
          minimum: 1
          maximum: 50
          description: |
            The most screens to read. After reaching the address, scrape
            scrolls the page to its end and returns all of it; this caps how
            far. Defaults to 10. `1` reads only the screen the address
            reaches. A page that does not scroll is one screen.
        device:
          type: string
          maxLength: 512
          description: |
            The id of the phone to run on. Pass it when the workspace has
            more than one phone.
        workspaceId:
          type: string
          format: uuid
          description: |
            Workspace scope for a credential that can reach several. A
            workspace-bound API key may omit it.
        expiresIn:
          type: integer
          minimum: 30
          description: |
            Shortens the viewer link's life, in seconds (it is capped at six
            hours). The run's own end always shortens it further, so this
            only ever makes a link expire sooner. A viewer link is a
            credential: hand out the shortest one that does the job.
    ScrapeTaskStarted:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          description: The task id, which is also the id of its session.
        liveViewUrl:
          type: string
          description: |
            A link to watch the phone while the scrape drives it, with no Lusor
            login: a bare player page you can embed in an iframe. Watch-only:
            its stream carries video only and the server refuses input for it.
            Omitted when the run is not recording or the phone cannot serve it.
    AgentDeviceError:
      type: object
      description: |
        A phone could not be chosen. `device_required`: the workspace has
        several phones; `no_device`: it has none; `unknown_device`: `device`
        is not one of them. `devices` lists the ids to choose from.
      required:
        - error
        - message
        - devices
      properties:
        error:
          type: string
          enum:
            - device_required
            - no_device
            - unknown_device
        message:
          type: string
        devices:
          type: array
          items:
            type: string
    ErrorResponse:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
    Busy:
      type: object
      description: |
        A `429` refusal. `device_busy` carries `currentSessionId` (the run
        holding the phone); `cap_busy` does not. A Persistent IP
        replacement can also answer `replace_limit` (3 in 24 hours) or
        `refund_pending`. Any authenticated request
        can also get `rate_limit_exceeded` when the API's request rate limit
        is exceeded; it comes with a `Retry-After` header in seconds.
      required:
        - error
      properties:
        error:
          type: string
          enum:
            - device_busy
            - cap_busy
            - replace_limit
            - refund_pending
            - rate_limit_exceeded
        currentSessionId:
          type:
            - string
            - 'null'
        message:
          type: string
    ScrapeFormat:
      oneOf:
        - type: string
          enum:
            - markdown
            - screenshot
        - $ref: '#/components/schemas/ScrapeScreenshotFormat'
        - $ref: '#/components/schemas/ScrapeJsonFormat'
    ScrapeScreenshotFormat:
      type: object
      required:
        - type
      description: |
        The screen's picture. With `fullPage: true` the document also
        carries `screenshots`, one picture per screen read, top to bottom.
      properties:
        type:
          type: string
          enum:
            - screenshot
        fullPage:
          type: boolean
    ScrapeJsonFormat:
      type: object
      required:
        - type
        - schema
      description: |
        Fields to read off the screen. The schema's top-level properties are
        plain values (string, number, integer or boolean), each read and
        checked against what the screen shows; a nested object, array or enum
        is a `400 unsupported_schema` in this step.
      properties:
        type:
          type: string
          enum:
            - json
        schema:
          type: object
          additionalProperties: true
  responses:
    Unauthorized:
      description: Authentication required or invalid credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    PaymentRequired:
      description: |
        The action was refused for billing and was not sent to the phone.
        `credits_exhausted` (`resource: "phone_minutes"`): the workspace is
        out of credits for Lusor Phone minutes, or reached its plan's
        allowance with overages off. `billing_required`: this Lusor Phone is
        not covered by an active paid plan.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TenantPaused:
      description: |
        `tenant_paused`: the account is paused. It can't start runs or buy
        or deploy phones; everything it already has keeps working. Contact
        support.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Workspace API key, created in the dashboard under Settings → API Keys.
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        The same workspace API key, sent as `Authorization: Bearer <your API
        key>`.

````

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