api_quickstart.txt

API quickstart

Drive your phones from the AutoViral REST API: authenticate, list phones, read the screen, tap and run workflows.

How the API works

The Phones API is one endpoint per action. Every action your AI agent can take over MCP is also a plain HTTP call:

POST https://autoviralapp.com/api/v1/phones/tools/<tool_name>
Content-Type: application/json
Authorization: Bearer <your API key>

{ ...the tool's arguments... }

The full list of tools, with a description and JSON schema for each, is public:

curl https://autoviralapp.com/api/v1/phones

Your phones must be connected to a running AutoViral Driver.

1. Get an API key

In the dashboard, open Settings › developer › api keys and generate a key, or run autoviral-driver, choose 3 (AI Driver Setup), then 1 (Setup MCP). Keys look like av_ followed by 64 characters; test keys start with av_test_. Both work on the same phones.

Send the key in either header:

Authorization: Bearer av_…
X-API-Key: av_…

Anyone with your key can drive your phones. Keep it out of source control and browser code. If it leaks, revoke it from the same screen and generate a new one.

The examples below assume:

export AV_KEY=av_your_key_here
export AV=https://autoviralapp.com/api/v1/phones

2. List your phones

curl -s -X POST "$AV/tools/list_phones" \
  -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{}'

Every tool replies in the same shape:

{
  "success": true,
  "data": {
    "text": "…what happened, as text…",
    "images": [ { "mimeType": "image/jpeg", "data": "<base64>" } ]
  }
}

list_phones gives each phone's id, what kind it is, and whether it is ready. Pass that id as "phone" to the other tools. You can leave phone out when only one phone is connected, or after choosing one with select_phone.

3. Read the screen

curl -s -X POST "$AV/tools/get_screen" \
  -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "PHONE_ID"}'

data.text lists every element on the screen with an index i and its text, and data.images holds a screenshot. To save the screenshot:

curl -s -X POST "$AV/tools/get_screen" \
  -H "Authorization: Bearer $AV_KEY" -H "Content-Type: application/json" \
  -d '{"phone": "PHONE_ID"}' \
  | jq -r '.data.images[0].data' | base64 -d > screen.jpg

4. Tap, type and open apps

Tap by element index from the latest screen (the most reliable), by visible text, or by coordinates:

curl -s -X POST "$AV/tools/tap" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"phone": "PHONE_ID", "index": 4}'

curl -s -X POST "$AV/tools/tap" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"phone": "PHONE_ID", "text": "Settings"}'

curl -s -X POST "$AV/tools/tap" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"phone": "PHONE_ID", "x": 540, "y": 1200}'

Every action returns the updated screen, so you rarely need another get_screen. Other common tools:

ToolArguments
text_inputtext (required), index, clearFirst, submit
open_apppackageName: the Android package or iPhone bundle id; on an iPhone that is not jailbroken, the app's name
press_keykey: e.g. home, back, enter
swipex1, y1, x2, y2, durationMs
scrolldirection (up/down/left/right), percentage
long_pressSame as tap, plus durationMs
upload_mediaurl (a public link, or a reference from upload_local_file) or contentBase64 (files up to 7 MB), fileName: puts a photo or video on the phone (on a control-board iPhone this is part of Controller Plus, added per phone: without it the call answers with the link that adds it to that phone)
upload_local_filepath (required), bytes: returns a command that sends a file from your computer to your account; see below
waitseconds (max 60)

Coordinates are phone screen pixels. Pass "coordSpace": "screenshot" to use pixels of the returned screenshot instead. Some tools only work on some kinds of phone; each tool's description in GET /api/v1/phones says which.

A file that is on your computer

The API cannot read a path on your computer. upload_local_file gives you a command that sends the file to your account, and a reference to use wherever a tool takes a url (upload_media, push_file, install_apk):

# 1. Ask for the upload command
curl -s -X POST "$AV/tools/upload_local_file" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"path": "~/Movies/reel.mp4"}'

# 2. Run the command from the reply on the computer that has the file. It prints:
#    {"success":true,"data":{"ref":"avmedia:…","fileName":"reel.mp4", …}}

# 3. Use that reference in place of a link
curl -s -X POST "$AV/tools/upload_media" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"phone": "PHONE_ID", "url": "avmedia:…"}'

The command is a plain curl upload (a PowerShell one for a Windows path) with no API key in it; its link works for 30 minutes and for more than one file. A photo or video comes back as avmedia:… and stays with your account until nothing has used it for a week; any other file, such as an APK, comes back as avfile:… and is kept for 24 hours. A file over 95 MB is sent in pieces: pass its size as bytes and the command does that for you. The limit is 500 MB.

5. Run a workflow

A workflow is a task you (or your AI) did once and saved, so it can repeat on any phone. See what you have:

curl -s -X POST "$AV/tools/list_workflows" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{}'

Run one by id or exact name, with any inputs it asks for:

curl -s -X POST "$AV/tools/run_workflow" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workflow": "Post a reel", "phone": "PHONE_ID", "inputs": {"caption": "hello"}, "waitSeconds": 240}'

The call waits up to waitSeconds (default 240, max 600) and reports the result. A longer run keeps going; check on it, or stop it, with the run id it returned:

curl -s -X POST "$AV/tools/get_workflow_run" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"runId": "RUN_ID"}'

curl -s -X POST "$AV/tools/get_workflow_run" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"runId": "RUN_ID", "cancel": true}'

To run workflows on a timetable, use create_schedule (once, daily, weekly or every N minutes). list_workflow_runs shows a workflow's history.

6. Proxies

Your proxy pool is the dashboard's Proxies tab, as tools. Phones are spread over the pool automatically (auto assigning); set_proxy puts one phone on a proxy you choose. Passwords are kept for the check and the phones only and are never returned.

An external proxy (a provider's endpoint on the internet) — AutoViral checks it:

curl -s -X POST "$AV/tools/add_proxy" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"protocol": "socks5", "host": "203.0.113.10", "port": 1080, "username": "me", "password": "…", "label": "provider 1"}'

A local proxy — one only a computer of yours can reach: a 5G modem's SOCKS on its network (192.168.x.x) or a SOCKS on that computer itself (127.0.0.1). Add it with driver = that computer's AutoViral Driver (its name or id, as on the dashboard's Drivers page). In the dashboard this is where → local to <Driver>. That Driver checks it, and only the phones plugged into that computer use it.

curl -s -X POST "$AV/tools/add_proxy" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"protocol": "socks5", "host": "192.168.2.207", "port": 10520, "username": "modem", "password": "…", "driver": "MY-PC"}'

What a local proxy needs:

  • The Driver is online and up to date — an older Driver cannot check local proxies (the proxy reads update driver).
  • That computer can reach the host and port itself. A private address without a Driver is refused (proxy_needs_driver).
  • IPv4 only — an IPv6 address is refused (proxy_ipv6_unsupported). Link-local, multicast and cloud-metadata addresses are never accepted.
  • macOS: allow Local Network access for the AutoViral Driver (System Settings → Privacy & Security → Local Network), or every LAN proxy fails with EHOSTUNREACH.
  • Android phones connect to their proxy themselves, so 127.0.0.1 would be the phone. For Android use the computer's network address (192.168.x.x), on a network the phone can reach. Jailbroken iPhones can use either.

See the pool, check one now, change or remove it:

curl -s -X POST "$AV/tools/list_proxies" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{}'
# → #12 "modem" · socks5://[email protected]:10520 · alive · exit 172.58.3.72 · 272 ms · local to MY-PC · yours · 3 phone(s): …

curl -s -X POST "$AV/tools/check_proxy" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"proxy": 12}'

curl -s -X POST "$AV/tools/update_proxy" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"proxy": 12, "enabled": false}'

curl -s -X POST "$AV/tools/remove_proxy" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"proxy": 12, "confirm": true}'

curl -s -X POST "$AV/tools/set_proxy" -H "Authorization: Bearer $AV_KEY" \
  -H "Content-Type: application/json" -d '{"phone": "PHONE_ID", "proxy": 12}'

A new login, a new Driver, switching a proxy off or removing it takes its phones off it first; auto assigning places them again. A teammate sees their team owner's proxies read-only and can use them on the phones assigned to them.

StateMeaning
aliveThe last check got through; it shows the exit IP and latency.
deadIt answered with an error, or refused the login. Phones move off a proxy that stays dead for 30 minutes.
driver offlineA local proxy whose Driver is not connected. Nothing is known, so it is not marked dead: its phones stay, no new ones are added.
update driverThe Driver is too old to check local proxies. Update it (the Driver updates itself hourly, or from the dashboard).
not checkedNot checked yet, or it could not be checked (the reason is shown) — for example a private address with no Driver.
unsupported — edit hostAn IPv6 host from before IPv6 was refused. Change it to an IPv4 address.
allow local networkA Mac's Driver is not allowed onto its own network yet. Turn on Local Network for the AutoViral Driver in System Settings → Privacy & Security → Local Network; the next check picks it up.
rebindIts Driver was signed out or removed. Make it local to another of your Drivers.
switched offYou switched it off (update_proxy with "enabled": false; disabled on the dashboard). Not checked, no phones.

Sessions

By default all calls from your account share one session, which remembers the phone you chose with select_phone. To keep separate scripts apart, open a session of their own and send its id with each call:

curl -s -X POST "$AV/sessions" -H "Authorization: Bearer $AV_KEY"
# → {"success": true, "data": {"sessionId": "…"}}

curl -s -X POST "$AV/tools/get_screen" -H "Authorization: Bearer $AV_KEY" \
  -H "X-Session-Id: SESSION_ID" -H "Content-Type: application/json" -d '{}'

curl -s -X DELETE "$AV/sessions/SESSION_ID" -H "Authorization: Bearer $AV_KEY"

Opening a session answers 201 and closing one answers 204 with no body.

A session closes by itself after 30 idle minutes.

Errors and limits

StatusMeaning
200{"success": true, "data": {…}}
400The tool ran but failed, or an argument was wrong: {"success": false, "error": "…"}
401Missing, invalid or revoked API key
404No such tool, or no such session
429Too many requests. Wait for the number of seconds in the Retry-After header.
500Something went wrong on our side. Retry, then contact support.

Each response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers. The Phones API allows 3,000 requests a minute per account, with bursts up to 60 a second.

Accounts API

If you have accounts on AutoViral, they have their own API at https://autoviralapp.com/api/v1/accounts, with the same API key. It covers your accounts and account groups, posts (list, create with media, schedule, run now), content, and analytics. Its full OpenAPI description is public:

curl https://autoviralapp.com/api/v1/accounts/openapi.json

curl -s "https://autoviralapp.com/api/v1/accounts/accounts" -H "Authorization: Bearer $AV_KEY"
curl -s "https://autoviralapp.com/api/v1/accounts/posts?status=scheduled&limit=50" -H "Authorization: Bearer $AV_KEY"

Its replies look like {"success": true, "meta": {…}, "data": …}.

Watch it done all 46 how-tos →