Skip to main content
Direct control lets your own code, or your own AI agent, operate a phone one action at a time. Each action runs once, as sent, and returns as soon as the phone has carried it out. No Lusor agent is involved. Every direct-control endpoint lives under the phone:
See Phones overview for how to find both ids.
On a Lusor Phone, direct control with an API key uses Lusor Phone minutes. See Billing below. Your own iPhone never uses them.

Read the screen

GET …/state returns the screen’s UI element tree:
For an image instead, GET …/screenshot takes a new screenshot and returns it as PNG bytes:

Act

Details:
  • Tap. Send index from the element tree, or x and y in pixels. If you send both, index wins. The response’s resolved field has the point that was tapped.
  • Swipe. durationMs is 1 to 60000.
  • Type. text is 1 to 8192 characters. clear: true empties the field first.
  • Key. keyCode is an Android key code. Common ones: 66 Enter, 67 Delete, 61 Tab, 111 Escape, 19 to 22 the arrow keys.
  • Apps. package and activity must be dotted identifiers such as com.android.settings. Anything else is a 400.
  • Screenshot. POST …/screenshot returns the same result shape as the other actions, so it can be a step in a chain. Use GET …/screenshot for the image itself.
Each action returns ok, exit_code (0 on success) and status. ok: false means the phone could not carry it out.
Actions are not idempotent. Retrying a tap that timed out may tap twice. Read the screen before you retry.
Add capture to any action to get the screen back in the same response. See Chains and capture.

Human-like input

tap, swipe and type accept "stealth": true: If the phone cannot do human-like input, the request returns 412 unsupported_stealth_input. It is never quietly sent as normal input.

Your own iPhone

On your own iPhone, the UI element tree is not available through the API yet:
  • GET …/state and tap with an index return 502.
  • A capture that asks for the element tree reports capture.failed.
Use GET …/screenshot and tap with { "x", "y" } coordinates instead. keyCode values and app package names are Android ones.

Billing

On a Lusor Phone, direct control with an API key uses Lusor Phone minutes, the same pool as agent runs:
  • The first action opens a metered window. Every further action keeps it open. The window closes 60 seconds after the last action, so a single action costs 60 seconds and a burst of actions costs its length plus 60 seconds.
  • Reads count too. GET …/state and GET …/screenshot are metered like actions. A chain is metered before each step.
  • Time that overlaps an agent run on the same phone is billed once, not twice.
  • Your own iPhone never uses Lusor Phone minutes.
When a Lusor Phone cannot be used, the action is refused and not sent to the phone. For how minutes, credits and overages work across agent runs and direct control, see Credits and minutes.