# Limits and quotas

Every fixed limit of the SDK and every quota of 360sona's servers, with the number. A limit in the library is
reported as `SONA_E_LIMIT` or `SONA_E_ARGUMENT` with a message and a fix (`sona_last_error`); a server quota
answers `429` with `Retry-After`, or `403` for a daily allowance.

## The library

| What | Limit | Where it is set |
|---|---|---|
| Avatars in one context | 256 by default, 16,384 at most | `sona_config.max_avatars` |
| Sources a context reads from | 4 | `SONA_MAX_SOURCES` |
| A manifest | 1,000 bytes; as base64, at most 4,096 characters with whitespace | `SONA_MANIFEST_BYTES` |
| Clips waiting in an avatar's queue | 8 | `SONA_QUEUE_MAX` |
| Animation layers on an avatar | 8, with 32 parameters | `SONA_LAYER_MAX`, `SONA_PARAM_MAX` |
| A state machine | 32 states, 64 transitions, 4 conditions a transition | `SONA_STATE_MAX`, `SONA_TRANSITION_MAX`, `SONA_CONDITION_MAX` |
| A blend space | 16 samples | `SONA_BLEND_SAMPLES_MAX` |
| Clip events held per avatar | 32, the oldest dropped past that | `SONA_CLIP_EVENT_MAX` |
| Marks on an avatar's clip | 16 | `SONA_MARK_MAX` |
| Props on one avatar | 8 | `SONA_PROP_MAX` |
| A custom item file | 4 MiB | `SONA_CUSTOM_ITEM_MAX_BYTES` |
| Baked looks per renderer (crowd sprites) | 16,384 by default | `sona_lod_options.max_looks` |
| A headless picture | 1 to 8,192 pixels a side | `sona_render_options.width`, `height` |
| Face sheets kept | 64 MiB and 512 sheets by default | `sona_budget.faces` |
| The offline catalogue file | 256 MB | `sona_catalogue_load` |
| A catalogue search | 1,024 bytes of text, 16 words | `sona_catalogue_query.text` |

The memory caps are `sona_budget`'s defaults, every one yours to change: decoded items no avatar uses default to
256 MiB, clips default to 32 MiB, face sheets default to 64 MiB, fetched files default to 64 MiB and idle GPU objects
default to 64 MiB. An item an avatar
needs is never refused for being over a cache's cap; `budget.total`, when you set it, is the hard limit
([memory](concepts.md#memory)).

## The command line

| What | Limit |
|---|---|
| `--dir` folders | 4 (or `$SONA_DIR`) |
| `sona render --size` | 8,192 pixels a side; 512 x 512 by default |
| `sona catalogue search --limit` | 5,000; 20 by default |
| `--timeout`, how long an avatar may take to build | 120 seconds by default |
| `sona scene --count` | 1 to 10,000 avatars |

## The web SDK

| What | Limit |
|---|---|
| Avatars in one scene | 256 by default, 1,024 at most |
| Origins per app | 10 |
| Different items per page load | 3,000 |

## The SDK's daily allowance

The SDK reports what it read from the gate; each app has an allowance per address and day.

| What | Limit |
|---|---|
| Items a day, per app and address | 10,000 different items |
| Answers a day, per app and address | 100,000 |
| Native build checks | 600 an hour per address |

Over it the answer is `403` until the next day (UTC). Caching avatars and reusing scenes keeps a game well
under it: an item read once stays in the context's cache for the run.

## The web API

| What | Limit |
|---|---|
| API calls per sign-in | 120 a minute |
| Token swaps per address | 30 a minute |
| Gamertag lookups | 60 an hour per address, and a shared hourly budget per app |
| Xbox saves | 6 an hour per account |
| Wardrobe, avatar tools and MCP | 600 an hour per address |
| SDK downloads | 10 an hour per app |
| Requests to us | 5 an hour per address |

A `429` carries `Retry-After`; wait that long, or a minute. A manifest does not change unless its player changes it,
so cache lookups ([the web API's limits](web-api.md#limits)).

## Asking for more

A limit of the library that is a default (`max_avatars`, the budget, `max_looks`) is yours to raise. For a server
quota, ask with `POST /sona/v1/requests` and say what your game needs ([requests](web-api.md#access)).
