API Documentation

RESTful API reference for the Android Emulator Automation System

API Overview

Introduction to our RESTful API endpoints

Base URL

https://adb.kaywat.codes

All API requests are handled by the ADB Bridge service running on the backend VM. No path prefix β€” endpoints are at the root.

Authentication

Protected endpoints (account, platform config) require a Bearer token obtained via the CLI device flow:

Authorization: Bearer YOUR_API_KEY_HERE

Obtain your API key by running justandr auth login or by authorizing via the CLI Auth page. Device / emulator streaming endpoints are public.

CLI Quick-Start

# Install the CLI
npm install -g ./cli

# Authenticate (opens browser automatically)
justandr auth login

# Configure a platform
justandr platforms enable tiktok
justandr platforms set tiktok account @yourhandle
justandr platforms set tiktok notify new_videos,new_followers
justandr platforms set tiktok automate auto_like,auto_follow

# Check status
justandr auth status
justandr emulator status

Response Format

Successful responses return JSON directly:

{ "ok": true, ... }          // mutation endpoints
{ "devices": [...] }         // list endpoints
{ "emulators": [...] }

Errors return:

{ "error": "description" }   // 4xx / 5xx

API Endpoints

All endpoints served at https://adb.kaywat.codes

Devices & Emulators

GET /api/devices/connected

List all ADB-connected physical devices (SIM-ready). Requires USB passthrough to be enabled on the host.

Response:

{
  "devices": [
    { "serial": "RF8N90ABCDE", "status": "device", "model": "SM-S918B", "product": "dm3q", "device": "dm3q" }
  ]
}
POST /api/devices/connect

Connect a device over Wi-Fi ADB (TCP/IP mode). The device must already be on the same network and have ADB over TCP enabled.

Request Body:

{ "ip": "192.168.1.42" }

Response:

{ "result": "connected to 192.168.1.42:5555" }
GET /api/emulators

List all running Android emulator instances (serials beginning with emulator-).

Response:

{
  "emulators": [
    { "serial": "emulator-5554", "status": "device", "model": "sdk_gphone64_x86_64" }
  ]
}
POST /api/emulator/profile

Apply a device hardware profile to a running emulator β€” sets screen resolution, DPI, and attempts to spoof build props (ro.product.model, ro.product.brand, ro.product.manufacturer). This is how device selection in the No SIM tab takes effect.

Request Body:

{
  "serial": "emulator-5554",
  "w": 1440,
  "h": 3088,
  "dpi": 500,
  "model": "SM-S918B",
  "brand": "samsung",
  "mfr": "samsung"
}

Response:

{ "ok": true, "size": "1440x3088", "dpi": 500 }

Screen & Input

GET /api/screen/:serial

Returns a live PNG screenshot of the device or emulator. The frontend polls this every ~800ms to render the interactive screen stream.

Path Parameter: serial β€” ADB serial (e.g. emulator-5554 or RF8N90ABCDE)

Response: image/png β€” raw screenshot bytes. Cache-Control: no-cache.

Error:

{ "error": "screenshot failed" }  // 503 if ADB unreachable
POST /api/input/:serial

Send touch or keyboard input to a device. Supports four actions.

Path Parameter: serial β€” ADB serial of the target device.

Request Body β€” tap:

{ "action": "tap", "x": 540, "y": 1200 }

Request Body β€” swipe:

{ "action": "swipe", "x1": 540, "y1": 1600, "x2": 540, "y2": 400, "duration": 300 }

Request Body β€” keyevent:

{ "action": "keyevent", "code": 3 }  // 3=HOME  4=BACK  187=RECENTS

Request Body β€” text:

{ "action": "text", "text": "Hello world" }

Response:

{ "ok": true }

CLI Authentication (Device Flow)

POST /cli/auth/request

Start a CLI login flow. Returns a short human-readable user_code for the browser and a long device_code used to poll for the resulting token. Codes expire after 10 minutes.

Response:

{
  "device_code": "a7f3k9...",
  "user_code": "ABCD-1234",
  "verification_uri": "https://justandroid.kaywat.codes/cli-auth",
  "expires_in": 600,
  "interval": 5
}
GET /cli/auth/poll?code=DEVICE_CODE

Poll for authorization status. The CLI calls this every 5 seconds after displaying the user code. Returns 202 while pending, 200 once the user approves.

Pending (202):

{ "status": "pending" }

Approved (200):

{ "status": "authorized", "token": "abc123...", "username": "youruser" }
POST /cli/auth/approve

Called by the browser CLI Auth page after the user enters the code and clicks Approve. Marks the device code as authorized and generates an API token.

Request Body:

{ "user_code": "ABCD-1234", "username": "youruser" }

Response:

{ "ok": true }
DELETE /cli/auth/logout

Revoke the current API key. Requires Authorization: Bearer TOKEN. Deletes the key from the server permanently.

Response:

{ "ok": true }

Account πŸ”’ Requires Bearer token

GET /cli/account

Returns current account summary: username, masked API key, enabled platforms, and live device/emulator counts.

Response:

{
  "username": "youruser",
  "api_key": "abc123de…",
  "platforms": ["tiktok", "youtube"],
  "emulators_running": 1,
  "devices_connected": 0
}

Platform Configuration πŸ”’ Requires Bearer token

GET /cli/platforms

Retrieve all configured platform settings for the authenticated account.

Response:

{
  "platforms": {
    "tiktok": {
      "enabled": true,
      "account": "@yourhandle",
      "notifications": ["new_videos", "new_followers"],
      "automations": ["auto_like", "auto_follow"],
      "webhook": "https://hooks.example.com/tiktok"
    }
  }
}
POST /cli/platforms

Overwrite all platform configs for the account in a single request.

Request Body:

{
  "platforms": {
    "tiktok": { "enabled": true, "account": "@yourhandle" },
    "youtube": { "enabled": false }
  }
}

Response:

{ "ok": true, "platforms": { ... } }
PATCH /cli/platforms/:name

Update a single platform's config. Only the fields you send are changed β€” other fields are preserved.

Path Parameter: name β€” lowercase platform identifier (e.g. tiktok, youtube, twitter)

Request Body (any subset):

{
  "enabled": true,
  "account": "@newhandle",
  "notifications": ["new_videos", "new_followers"],
  "automations": ["auto_like"],
  "webhook": "https://hooks.example.com/tiktok"
}

Response:

{ "ok": true, "platform": { "enabled": true, "account": "@newhandle", ... } }
DELETE /cli/platforms/:name

Remove a platform's configuration entirely from the account.

Response:

{ "ok": true }

Health

GET /health

Returns bridge service status and process ID. No authentication required.

Response:

{ "status": "ok", "pid": 1234 }

API Reference

Detailed reference for API parameters and error codes

HTTP Status Codes

Status Code Description
200 Success - Request completed successfully
201 Created - Resource created successfully
400 Bad Request - Invalid request parameters
401 Unauthorized - Missing or invalid API key
403 Forbidden - Insufficient permissions
404 Not Found - Resource not found
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Server error occurred

Error Codes

Code Description
INVALID_API_KEY The provided API key is invalid or expired
EMULATOR_NOT_FOUND The specified emulator does not exist or is not running
PLATFORM_NOT_SUPPORTED The requested platform is not supported
INVALID_CONFIGURATION The configuration contains invalid parameters
WEBHOOK_URL_INVALID The webhook URL is malformed or unreachable
RATE_LIMIT_EXCEEDED API rate limit has been exceeded
INTERNAL_ERROR An internal server error occurred

Platform Identifiers

Identifier Platform Notes
tiktok TikTok Android app package: com.zhiliaoapp.musically
youtube YouTube Android app package: com.google.android.youtube.music
twitter Twitter/X Android app package: com.twitter.android
facebook Facebook Android app package: com.facebook.katana
instagram Instagram Android app package: com.instagram.android
threads Threads Android app package: com.threads.android
twitch Twitch Android app package: tv.twitch.android.app
kick Kick Android app package: com.kick.android

API Testing Console

Test API endpoints directly from your browser

Response

200 OK 124ms
// Select an endpoint and click Test API