# Limits and quotas

> Every limit in one place - rate limits, concurrent devices, snapshot quotas, input and instruction lengths, upload sizes, timeouts and data retention.

Source: https://akaphone-docs.pages.dev/guides/limits-and-quotas/

## Rate limits

Limits are per account (all your API keys and your dashboard session share them) and work as token buckets that refill continuously.

| What | Limit | Error |
|---|---|---|
| All authenticated REST requests (`/v1/…`) | 120 per minute | `429 rate_limited` |
| Device creation (`POST /v1/devices`, snapshot restores) | 10 per minute | `429 rate_limited` |
| Task creation (`POST /v1/devices/:id/tasks`) | 30 per minute | `429 rate_limited` |
| Snapshot creation | 5 per hour | `429 rate_limited` |
| Input over the live stream | 20 messages per second per connection | `error` event on the socket |
| Starting Google sign-in | 30 per minute per IP address | `429 rate_limited` |

A `429` response carries a `Retry-After` header with the number of seconds to wait. There are no `X-RateLimit-*` headers. Back off for `Retry-After` seconds and retry; the [REST overview](https://akaphone-docs.pages.dev/api/rest/#rate-limits) has a retry helper.

## Account limits

| | Free | Dev | Team |
|---|---|---|---|
| Devices at once (`queued` + `creating` + `running`) | 1 | 3 | 5 |
| Snapshots held (`pending` + `ready`) | 1 | 5 | 20 |
| Live view frame rate | 2 fps | 4 fps | 5 fps |
| Retention of tasks and artifacts | 7 days | 30 days | 90 days |

| Limit | Value |
|---|---|
| Active API keys | 25 per account (`409 conflict` beyond that) |
| Minimum balance to create a device | 1 credit (`402 insufficient_credits`) |
| Active tasks per device | 1 (`409 conflict`) |

## Sizes and lengths

| Field | Limit |
|---|---|
| Task `instruction` | 1 to 8,000 characters (after trimming whitespace) |
| Input `text` | 1 to 500 characters per message |
| Input coordinates (`x`, `y`, `x1`…`y2`) | integers 0 to 10,000 |
| Swipe `ms` | 1 to 10,000 (default 300) |
| Device and snapshot `name`, API key `name` | up to 64 characters |
| Device `profile` | `pixel_8`, `pixel_tablet` or `small_phone` |
| Device `android` | 1 or 2 digits |
| Upload `filename` | 5 to 128 characters, ending in `.apk` |
| Upload size | 300 MB (314,572,800 bytes) |
| `GET /v1/tasks` `limit` | 1 to 200 (default 50) |
| `GET /v1/billing/ledger` `limit` | 1 to 500 (default 50) |
| `GET /v1/devices?status=all`, `GET /v1/snapshots` | the 200 most recent |

## Timeouts

| What | Value | Result |
|---|---|---|
| `wait` on device creation | 90 seconds maximum | Returns the device in its current status with `X-Wait-Timed-Out: 1` |
| APK install | 15 minutes | Install becomes `failed` with `timeout` |
| Queued device | 10 minutes | Device goes to `error` with `no_capacity` |
| Idle running device | 30 minutes without activity | Device stops with reason `idle` |
| Queued task | 5 minutes | Task fails with `timeout` |
| Running task | 1,900 seconds | Task fails with `timeout` |
| Screenshot | 8 seconds to get a frame | `504` with code `internal` |
| Presigned upload URL | 15 minutes | Storage rejects the `PUT` |
| Artifact download URL | 15 minutes | Request the artifact list again |
| Stream token | 5 minutes, single use | Get a new token |
| Dashboard session | 30 days | Sign in again |

## Retention

| Data | Kept for |
|---|---|
| Task records, steps and artifacts (video, screenshots, trace, log) | Your plan's retention: 7, 30 or 90 days |
| Uploaded APKs | 7 days |
| Install records | 30 days |
| Snapshots | Until you delete them, or until the host holding them is lost |
| Device records | Kept; `GET /v1/devices?status=all` shows the 200 most recent |
| Credit ledger | Kept; usage rows older than 90 days are combined into one row per month |
| Model keys | Never stored |

## Raising limits

Buying any credit pack moves you to Dev (3 devices). The Team pack gives 5 devices for 30 days. For more, contact [hello@akaphone.com](mailto:hello@akaphone.com) about an Enterprise plan.
