Skip to Content
Spawndroid

API reference

Upload builds, start and manage Android runners, receive CI events, and create share links programmatically.

The Spawndroid API lets a pipeline or service upload builds, start and manage Android runners, receive CI events, and create share links. Every request is scoped to a workspace and authenticated with an API key or a signed-in console session.

Authentication

Create an API key under API & CI/CD → API keys. The secret is shown once; Spawndroid stores only a SHA-256 hash. Send it as a bearer token:

curl https://app.spawndroid.io/api/apps \
  --header "Authorization: Bearer $SPAWNDROID_API_KEY"

Keys carry a scope, enforced on every request. Scopes form a hierarchy: read ⊂ upload ⊂ full.

ScopeAllows
fullEverything, including deleting builds
uploadUpload builds, start and tear down runners, set mock location, and read
readRead builds, runner history, and retained Logcat captures and recordings

Console requests authenticate with the signed-in session instead of a key, so the same routes work in both contexts. Only workspace admins can create or revoke API keys, webhooks, and share links.

Base URL and conventions

All routes are served from https://app.spawndroid.io.

  • Requests and responses use JSON, except multipart uploads and JUnit XML reports.
  • Timestamps are ISO 8601 strings.
  • Errors return a JSON body with an error string and an HTTP status. Some errors also include a code; see Errors.

Builds

POST /api/apps/presign

Mint a short-lived presigned PUT so the client uploads the build directly to object storage. This is the recommended path for CI and large builds because the bytes do not pass through the API function.

Body:

{ "filename": "app-release.apk", "size": 42000000 }

.apk and .aab files are accepted, up to 512 MB. An AAB is stored and its manifest is decoded for the build record. When a session starts, the device host converts it to a universal APK with bundletool before installing it. The response gives you a storage key and a URL:

{
  "key": "org_123/apps/app-release.apk",
  "url": "https://…",
  "contentType": "application/vnd.android.package-archive"
}

An .aab is stored with the content type application/octet-stream. Upload the file bytes to url with a PUT, then register the key with POST /api/apps.

POST /api/apps

Register an uploaded build and return the build record. Two bodies are accepted.

BodyContent typeWhen to use
{ key, filename, manifest? }application/jsonAfter a presigned upload. Recommended for pipelines.
multipart filemultipart/form-dataBuilds under 4 MB only; larger bodies return 413.

The response is { app, parsed, icon }. The app object includes the build's globally unique slug. Uploading a new version of the same package appends to the build; uploading the same version code replaces that release. Registering a build never boots a device.

APK=app-release.apk
AUTH="Authorization: Bearer $SPAWNDROID_API_KEY"
presign=$(curl -fsS -X POST https://app.spawndroid.io/api/apps/presign -H "$AUTH" \
  -H "Content-Type: application/json" \
  -d "{\"filename\":\"$(basename "$APK")\",\"size\":$(wc -c < "$APK" | tr -d ' ')}")
curl -fsS -X PUT "$(jq -r .url <<<"$presign")" \
  -H "Content-Type: $(jq -r .contentType <<<"$presign")" \
  --data-binary @"$APK"
curl -fsS -X POST https://app.spawndroid.io/api/apps -H "$AUTH" \
  -H "Content-Type: application/json" \
  -d "{\"key\":\"$(jq -r .key <<<"$presign")\",\"filename\":\"$(basename "$APK")\"}"

GET /api/apps

List the builds in the workspace. Returns { "apps": [ … ] }.

DELETE /api/apps/:slug

Delete a build, stop its live runners, and remove every retained version from storage. Returns { deleted, sessionsStopped }.

POST /api/apps/:slug/stream

Create a device, install the selected version, and open a live session. An .aab is converted to a universal APK on the device host before installation; the conversion adds a few seconds to the first launch of that build.

{
  "versionCode": 42,
  "profileId": "android-14-phone",
  "config": { "locale": "de-DE", "orientation": "landscape" }
}

Every field is optional. profileId picks a cell from the device matrix. config layers per-session overrides (locale, orientation, and screen size) on top of it. Omit config to stay eligible for the host's warm pool; any override forces a freshly configured device.

The response is { session, package, launched }.

StatusReason
429The device-minute allowance is reached, with code: "PLAN_DEVICE_MINUTES_EXHAUSTED" (legacy device-minutes)
429Every parallel slot is busy, with code: "PLAN_RUNNER_LIMIT" (legacy concurrency)

GET /api/apps/:slug/session

Return the newest live runner for a build, or { "session": null }. This is the endpoint the player polls.

Sessions

GET /api/sessions

List the runner history for the workspace.

DELETE /api/sessions/:id

Stop a running session. The console uses this as its kill switch.

POST /api/sessions/:id/heartbeat

Keep a session's device alive while a viewer is connected. Returns { ok }. The console calls this on a timer; a session with no heartbeat is reaped by the device host and returned to the pool.

GET /api/sessions/:id/logcat

Return live Logcat lines from the running device. Pass ?lines= to choose how many, clamped between 1 and 5000 and defaulting to 300. Pass ?scope=all to include framework lines; the default is the app's own lines. The response is { available, lines }.

GET /api/sessions/:id/device

Return the live device configuration decoded from the running device.

POST /api/sessions/:id/location

Set or clear the device's mock GPS fix. Requires an API key with upload scope.

{
  "location": { "latitude": 51.5074, "longitude": -0.1278, "accuracy": 25 }
}

Send { "location": null } to clear the fix. accuracy is optional and measured in meters. The response is { ok, location }. See Mock location.

CI sessions

Hosted runners for pipelines. The full walkthrough, capabilities, and a complete pipeline example live in the CI tests guide. Most pipelines do not need these calls directly: npx spawndroid run performs the upload, start, wait, fixtures, report and teardown for you, and npx spawndroid init writes the spec it reads.

POST /api/v1/sessions

Provision a hosted Android runner and an Appium endpoint. The body names the build to install.

{
  "artifactId": "my-app",
  "profileId": "android-14-phone",
  "commit": "9fceb02",
  "branch": "main",
  "repoUrl": "https://github.com/acme/app",
  "location": { "latitude": 35.6762, "longitude": 139.6503 }
}

artifactId is required and accepts the app's slug (the app.slug returned by the upload), its id (app_…), or its package id. profileId, commit, branch, repoUrl and location are optional; the three revision fields appear on the run and power the commit link-out. source defaults to api and should stay unset for pipeline runs. The response returns 201 with everything a pipeline needs to build its capabilities:

{
  "sessionId": "sess_1234",
  "state": "booting",
  "webdriverUrl": "https://…/ci/sess_1234/tok_…/wd/hub",
  "eventsUrl": "https://…/events/sess_1234?token=…",
  "device": {
    "serial": "spawndroid-sess_1234-redroid:5555",
    "apiLevel": 34,
    "osVersion": "14"
  },
  "app": { "package": "com.example.app" }
}

device.serial identifies the device to Appium as appium:udid. It is an opaque host-local name, not an adb endpoint a pipeline can connect to.

Send an Idempotency-Key header on this request. A retry after a timeout or network failure with the same key resolves to the original attempt instead of provisioning a second device. While the first attempt is still creating, the retry returns 409 with code: "in_progress"; keep retrying with the same key. A key whose launch failed is recorded as failed; use a new key to start a fresh attempt.

Provisioning is asynchronous. Follow eventsUrl over SSE, or poll until state is ready. The WebDriver URL is stable from creation.

GET /api/v1/sessions/:id

Readiness read. Returns { sessionId, state, error, webdriverUrl, eventsUrl, device, package }.

Once the run has ended, the answer also says how it went:

{
  "state": "stopped",
  "result": "failed",
  "fault": {
    "kind": "crash",
    "title": "The app crashed",
    "summary": "IllegalStateException: cart is null",
    "exception": "java.lang.IllegalStateException: cart is null",
    "frame": "com.shop.CartActivity.onCreate(CartActivity.kt:42)",
    "count": 1
  },
  "durationSeconds": 71,
  "minutesUsed": 1,
  "previewUrl": "https://app.spawndroid.io/p/…"
}

fault is the crash or ANR the device saw during the run (also on a live run, so a pipeline can stop on an ANR, where the app is still alive) (kind is crash, native or anr), or null. minutesUsed counts from the moment the device was ready, rounded up, as the usage meter does. previewUrl is the pull request's live preview when the GitHub App covers the repository and previews are on; it starts a device, so a read key never receives it. errorResponsible says whose fault a failed start was: user for the build itself (a wrong-architecture APK, a minSdk above the device), otherwise the platform's side (platform, capacity, upstream).

DELETE /api/v1/sessions/:id

Tear down the runner, retain its artifacts, and record the outcome.

{ "result": "failed", "report": "<testsuite …>…</testsuite>" }

Send "captureScreen": true to keep the screen the run ended on; the response then carries screenshotUrl, a signed image URL that opens without an account.

result may be passed or failed and defaults to passed, so a pipeline that never reports an outcome still closes cleanly. report is optional JUnit XML (8 MB max), attached before teardown like POST /api/v1/sessions/:id/report; an invalid report never blocks teardown. The response is { ok, result, logcatStored, videoStored }, plus reportAttached (and reportError when it is false) when a report was sent.

POST /api/v1/sessions/:id/public-link

A read only link to one run (its result, recording and final screen) that opens without an account, for a pull request comment. Needs an upload key.

{ "repoPrivate": false }

Returns 201 with { url, expiresAt }; the link expires after 30 days and any workspace member can revoke it from the run page. A run from a private repository gets 403 unless a workspace admin turned on Settings → Workspace → Public run links for private repositories.

GET /api/v1/whoami

Return what the presented credential can do: the key's scope and the limits of the workspace's plan. spawndroid check calls this before the first run, so a read-scoped key or a too-short session cap fails early instead of mid-pipeline.

{
  "tenantId": "org_…",
  "workspace": { "name": "Acme", "slug": "acme" },
  "scope": "upload",
  "via": "key",
  "plan": "free",
  "planLabel": "Hobby",
  "slots": 1,
  "maxSessionMinutes": 15,
  "maxApiKeys": 1,
  "retentionDays": 7
}

workspace is the workspace the key belongs to, so its runs and builds appear there. scope is one of read, upload or full; via is session, key or service. Running a session needs upload or full. maxSessionMinutes is the cap for a manual session. CI runs are bounded by the host ceiling instead, and end after 15 minutes without an Appium command.

POST /api/v1/sessions/:id/report

Attach a JUnit XML report to the run. Send the XML as the request body:

curl --request POST "https://app.spawndroid.io/api/v1/sessions/$SESSION_ID/report" \
  --header "Authorization: Bearer $SPAWNDROID_API_KEY" \
  --header "Content-Type: application/xml" \
  --data-binary @junit.xml

The report is parsed on upload. The run page shows the totals and the failing tests by name, and the raw XML is retained. Returns 201 with { ok, report }.

POST /api/v1/sessions/:id/files/presign

Copy a fixture onto the running device's shared storage. Use this when a test depends on a config, a media sample or another asset that must be present before the app runs.

Step one mints a short-lived upload URL. Send the file size so the 32 MB cap is enforced before any bytes move:

curl --request POST "https://app.spawndroid.io/api/v1/sessions/$SESSION_ID/files/presign" \
  --header "Authorization: Bearer $SPAWNDROID_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"filename":"fixture.json","path":"/sdcard/Download","size":64}'

Returns { key, url, contentType }. path is a folder under /sdcard.

POST /api/v1/sessions/:id/files

Step two uploads the bytes to url with a plain PUT, then commits them:

curl --request POST "https://app.spawndroid.io/api/v1/sessions/$SESSION_ID/files" \
  --header "Authorization: Bearer $SPAWNDROID_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"key":"…","path":"/sdcard/Download","filename":"fixture.json"}'

The key is scoped to the workspace and session that minted it; another session's key is refused. The host resolves the folder inside shared storage, replaces a file of the same name, and asks the media library to index it. Returns { ok, path, name, size, scanned }. The staged upload is deleted after the push.

GET /api/v1/sessions/:id/logcat

Download the retained Logcat capture. Add ?format=json to receive parsed lines instead of a file. Available on Personal and above; Hobby returns a plan-limit error.

GET /api/v1/sessions/:id/video

Download the retained screen recording. Available on Personal and above.

GET /api/v1/sessions/:id/crash-report

Return the crashes, ANRs and native crashes found in the run's retained Logcat, each with the surrounding log lines, as { reports }. Add ?format=download for a plain-text file. Available on Team plans and above.

Share links are scoped to one build. The full token is returned only when the link is created; Spawndroid stores a hash and shows the prefix later. Creating and revoking links requires a workspace admin in the console, or an API key with full scope; listing them needs read.

POST /api/apps/:slug/share

Create a share link.

{ "expiry": "7d", "viewOnly": true }

expiry is 24h, 7d, or 30d and defaults to 24h. The longest allowed value depends on the plan: Hobby 1 day, Indie 7 days, Personal 30 days, Team 90 days. viewOnly defaults to true; set it to false to let the recipient control the device.

Optionally pass password (8 to 128 characters) to require it before the link opens. Passwords are available on Team plans and above and are stored as salted hashes; the response then has "passwordProtected": true.

Returns 201 with { link }, including the one-time url:

{
  "link": {
    "id": "shr_1f8c…",
    "appSlug": "my-app",
    "prefix": "shr_1f8c…",
    "expiresAt": "2026-11-03T09:30:00.000Z",
    "revokedAt": null,
    "views": 0,
    "lastViewedAt": null,
    "viewOnly": true,
    "createdAt": "2026-10-27T09:30:00.000Z",
    "url": "https://app.spawndroid.io/p/shr_…"
  }
}
StatusReason
400The expiry is longer than the plan allows, with code: "plan-limit"
403The caller is a member, or the plan's active-link limit is reached
501Sharing is disabled on this deployment

GET /api/apps/:slug/share

List the build's share links. Any workspace member can read the list. Returns { links }; the token and URL are not included.

DELETE /api/apps/:slug/share/:id

Revoke a share link. Revocation is permanent and takes effect on the next request. Returns { ok, appSlug }.

Device profiles

GET /api/device-profiles

Return the device catalog used by the console picker:

{
  "profiles": [ … ],
  "defaultProfileId": "android-14-phone",
  "warmProfileIds": ["android-15-phone", "android-16-phone"],
  "workspaceId": "org_123"
}

Pass a profile id as profileId when starting a runner. warmProfileIds lists profiles the host has pre-booted; workspaceId scopes the console's remembered selection.

Webhooks and notifications

Signed webhooks are available on Indie plans and above. Slack and email notifications are available on Team plans and above. Creating a channel your plan does not include returns a plan-limit error.

Workspace notifications deliver CI events to a destination you choose. Create one under Settings → Integrations → Webhooks:

ChannelDestinationFormat
Webhookan HTTPS endpoint you controlsigned JSON (HMAC)
Slacka Slack incoming-webhook URLa formatted message
Emailone recipient addressa summary with links

Events

EventFires when
artifact.uploadedA build is stored or replaced
session.startedA runner starts, including CI runners
session.endedA runner finishes, carrying its result and artifacts

Payload

A webhook event is a JSON POST with three headers:

  • x-spawndroid-event: the event name.
  • x-spawndroid-signature: sha256= followed by an HMAC of the raw request body, computed with the subscription secret.
  • x-spawndroid-delivery: a unique ID for this delivery. It is the same on every retry of the same event.

The payload contains the event name, the workspace ID, a timestamp, and a data object. For session.ended, data also carries clickable links (a short-lived presigned URL for the recording and the Logcat capture, and a link to the run), so a Slack or email notification is self-contained.

{
  "event": "session.ended",
  "tenantId": "org_123",
  "timestamp": "2026-10-12T09:30:00.000Z",
  "data": {
    "sessionId": "sess_1234",
    "appSlug": "my-app",
    "appName": "My App",
    "result": "failed",
    "runUrl": "https://app.spawndroid.io/dashboard/runs/sess_1234",
    "videoUrl": "https://…/recordings/sess_1234.mp4?X-Amz-…",
    "logcatUrl": "https://…/logcats/sess_1234.txt?X-Amz-…"
  }
}

Recompute the HMAC over the raw body and compare it with the header before trusting the request. Slack and email channels are not signed. Deliveries are written to a durable outbox and sent as soon as the event happens, usually within seconds. A failed delivery is retried up to four more times by a scheduled worker, after about 5 minutes, 30 minutes, 2 hours and 6 hours, so an endpoint that is down for a few hours does not lose the event. Delivery is at-least-once: dedupe on x-spawndroid-delivery if your endpoint is not idempotent, and treat any channel as a signal to fetch the latest state, not as the only record.

Errors

StatusMeaning
400The request is malformed, a required field is missing, or an expiry exceeds the plan limit
401The key or session is missing or invalid
403The caller is not an admin, is missing a scope, or the plan limit is reached
404The build, version, or session does not exist in this workspace
409The Idempotency-Key is still creating or belongs to a failed launch, with code: "in_progress"
413The build exceeds the 512 MB limit, or a fixture exceeds 32 MB
429A plan limit or capacity: PLAN_DEVICE_MINUTES_EXHAUSTED, PLAN_RUNNER_LIMIT, or a pool reason
501Sharing or mock location is not configured on this deployment
502The device host could not be reached or the runner failed to boot
503The device host, WebDriver hub, or object storage is not configured

code values include PLAN_DEVICE_MINUTES_EXHAUSTED (legacy device-minutes) and PLAN_RUNNER_LIMIT (legacy concurrency) on 429, in_progress on 409, and plan-limit on 400/403. Capacity 429s also carry a pool reason such as free_pool_full, paid_pool_empty or paid_pool_full; plan-limit 429s are not worth retrying, capacity ones are.

PLAN_RUNNER_LIMIT

POST /api/v1/sessions answers 429 with code: "PLAN_RUNNER_LIMIT" when every parallel runner in the workspace is busy. code is the stable machine-readable value to branch on; legacyCode: "concurrency" remains for older clients. The body names what is holding the runners, and Retry-After gives the seconds until the soonest holder must stop:

HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json; charset=utf-8
Retry-After: 3000
{
  "code": "PLAN_RUNNER_LIMIT",
  "legacyCode": "concurrency",
  "status": 429,
  "retryable": false,
  "retryAfterMs": 3000000,
  "detail": "Concurrency limit reached (1/1 slots active). Session sess_1234 (My App) is holding a runner; stop it or retry after 2026-11-26T12:50:00.000Z.",
  "limit": 1,
  "active": 1,
  "holders": [
    {
      "sessionId": "sess_1234",
      "startedFrom": "dashboard",
      "build": { "app": "My App", "appSlug": "my-app", "versionCode": 42 },
      "startedAt": "2026-11-26T11:50:00.000Z",
      "runningSeconds": 600,
      "stopsBy": "2026-11-26T12:50:00.000Z",
      "stopsByReason": "plan_cap",
      "idleTimeoutSeconds": 600
    }
  ],
  "requestId": "req_…"
}
FieldMeaning
limitThe workspace's parallel runners
activeSessions holding a runner now
holders[]Those sessions, soonest to free first. Only sessions in the caller's workspace
holders[].startedFromci (a pipeline run with a commit, or the CLI), api, dashboard or share_link
holders[].stopsByThe latest moment the session can still be running
holders[].stopsByReasonplan_cap (the plan's session length) or host_ceiling (8 hours, the bound for CI runs)
holders[].idleTimeoutSecondsThe session ends sooner if idle this long: the plan's idle window for a stream, 15 minutes for a CI device

retryable stays false: retrying straight away cannot succeed. Wait for Retry-After, or poll more often if you expect a holder to finish early, and send a new Idempotency-Key with each retry, because the refused key is settled as a failed launch and replays 409. To free a runner instead, end the holder with DELETE /api/v1/sessions/:id.

Next steps

Was this page helpful?

On this page