---
source_url: https://www.pubnub.com/docs/data-storage/metadata/api-limits
title: App Context API limits
updated_at: 2026-09-30T07:20:08.000Z
---

# App Context API limits

## Documentation index

To discover more PubNub resources:

1. Fetch [PubNub's llms.txt](https://www.pubnub.com/llms-full.txt) for a list of available pages in Markdown format.
2. Identify relevant URLs from that index.
3. Fetch the target pages.

Do not assume a path exists, always check the index first.

:::note Starting a new app? Use DataSync
[DataSync](https://www.pubnub.com/docs/data-storage/structured-data/overview.md) is the successor to App Context. It does everything App Context does for users, channels, and memberships, and adds typed schemas, partial updates with ETags, field-level access control, and per-class expiry. Refer to [How DataSync compares to App Context](https://www.pubnub.com/docs/data-storage/structured-data/overview.md) for a feature-by-feature comparison.
DataSync is currently available to new accounts and to accounts that are not actively using App Context. If your keysets already use App Context, keep using it for now. App Context remains fully supported and these pages stay accurate.
:::

[App Context](https://www.pubnub.com/docs/data-storage/metadata/overview.md) enforces size, count, and field-length limits on every user, channel, and membership metadata record. This reference lists:

* the maximum size of one metadata record, and the record and membership counts PubNub recommends per keyset
* the maximum length of each field on a user, channel, and membership record
* what happens when a write would exceed one of these limits

These limits apply the same way whether you write through an SDK, the [REST API](https://www.pubnub.com/docs/sdks/rest-api.md), or [BizOps Workspace](https://www.pubnub.com/docs/data-storage/metadata/overview.md), since all three call the same underlying App Context API.

## Record and count limits

| Item | Limit | Notes |
| --- | --- | --- |
| Metadata record size | One user, channel, or membership metadata record can hold up to 32 KiB, counting every field including `custom`. | This is a storage limit on the record, separate from the [publish message-size limit](https://www.pubnub.com/docs/architecture/limits.md#publish). |
| User and channel metadata records | 1 million each (recommended) | Recommended maximum per keyset when using the App Context API. |
| Memberships and channel members | Platform limits apply: up to 50,000 memberships per user and up to 5,000 members per channel. |  |
| Members or memberships per write | 20 per request | Maximum number added or removed in a single App Context call. |

For the maximum length of individual fields such as `name`, `externalId`, `email`, `type`, and `status`, see the REST API reference for [setting user metadata](https://www.pubnub.com/docs/sdks/rest-api/set-user-metadata.md), [channel metadata](https://www.pubnub.com/docs/sdks/rest-api/set-channel-metadata.md), [a user's channel memberships](https://www.pubnub.com/docs/sdks/rest-api/set-membership-metadata.md), and [a channel's members](https://www.pubnub.com/docs/sdks/rest-api/set-channel-members-metadata.md). If a `custom` field holds an integer, such as a timetoken, send it as a string when the value can exceed `9007199254740991`, the largest integer JSON can represent without losing precision.

## Field-length limits

Each field on a user, channel, or membership record has its own maximum length, separate from the [record's overall size limit](#record-and-count-limits). A record can exceed that ceiling even when every field is within its own maximum.

### Text fields

A `name`, `externalId`, `profileUrl`, or `description` field holds up to 2,048 characters.

| Field | Entity | Also requires |
| --- | --- | --- |
| `name` | User, Channel | Can't be empty or contain only whitespace |
| `externalId` | User |  |
| `profileUrl` | User | Valid URI syntax ([RFC 3986](https://www.rfc-editor.org/rfc/rfc3986)) |
| `description` | Channel |  |

### The email field

An `email` field holds up to 320 characters. It must use [RFC 5322](https://www.rfc-editor.org/rfc/rfc5322)/[RFC 6532](https://www.rfc-editor.org/rfc/rfc6532) address syntax, without a display name. It exists on users only.

### The type and status fields

The `type` and `status` fields hold up to 50 characters and accept only letters, digits, and the period (`.`) character. The same rule applies on users, channels, and memberships. A [membership](https://www.pubnub.com/docs/data-storage/metadata/overview.md#membership-connects-users-and-channels) call and a members call read and write the same underlying record from opposite directions, so the limit is identical no matter which direction you use.

### The custom field

On every entity above, `custom` accepts only scalar string, number, or boolean values. Arrays and nested objects aren't supported. For the integer precision limit on a numeric `custom` value, refer to the note under [Record and count limits](#record-and-count-limits).

### Where to set these fields

* [Set, get, and remove user metadata](https://www.pubnub.com/docs/data-storage/metadata/manage-user-metadata.md), or the REST API's [Set user metadata](https://www.pubnub.com/docs/sdks/rest-api/set-user-metadata.md) endpoint.
* [Set, get, and remove channel metadata](https://www.pubnub.com/docs/data-storage/metadata/manage-channel-metadata.md), or the REST API's [Set channel metadata](https://www.pubnub.com/docs/sdks/rest-api/set-channel-metadata.md) endpoint.
* [Set, get, and remove memberships](https://www.pubnub.com/docs/data-storage/metadata/manage-memberships.md) and [Set, get, and remove members](https://www.pubnub.com/docs/data-storage/metadata/manage-members.md), or the REST API's [Set membership metadata](https://www.pubnub.com/docs/sdks/rest-api/set-membership-metadata.md) and [Set channel members' metadata](https://www.pubnub.com/docs/sdks/rest-api/set-channel-members-metadata.md) endpoints.

## Identifier length limits

The `name` limits above apply to the display name stored inside a metadata record, not to the record's own identifier. A [User ID](https://www.pubnub.com/docs/architecture/core-concepts.md#user-id) and a [channel](https://www.pubnub.com/docs/architecture/core-concepts.md#channel) name each have their own, shorter length limit that applies everywhere on the platform, not only in App Context:

* A User ID cannot exceed 92 UTF-8 characters.
* Channel names cannot exceed 92 UTF-8 characters.

Refer to [API limits](https://www.pubnub.com/docs/architecture/limits.md#publish) for the full identifier reference.

## What happens when you exceed a limit

* A write that would push an App Context record, or a single field on it, past its length limit fails with a `400 Bad Request` error.
* An unrecognized property name in an App Context `set` call doesn't fail the request, because PubNub silently ignores it instead. Check your request for a typo if a field doesn't appear in the response.
* The App Context record-count and membership-count limits are recommended maximums rather than enforced ceilings, so PubNub returns no error for exceeding them. Design your application to stay within them anyway.

## Next steps

* [App Context](https://www.pubnub.com/docs/data-storage/metadata/overview.md). The three entity types, how to turn on App Context, and where these limits apply.
* [Set, get, and remove user metadata](https://www.pubnub.com/docs/data-storage/metadata/manage-user-metadata.md). Apply the user metadata field limits.
* [Set, get, and remove channel metadata](https://www.pubnub.com/docs/data-storage/metadata/manage-channel-metadata.md). Apply the channel metadata field limits.
* [Set, get, and remove memberships](https://www.pubnub.com/docs/data-storage/metadata/manage-memberships.md). Apply the membership field limits from a user's perspective.
* [Set, get, and remove members](https://www.pubnub.com/docs/data-storage/metadata/manage-members.md). Apply the membership field limits from a channel's perspective.
* [App Context filtering](https://www.pubnub.com/docs/data-storage/metadata/filtering.md). Query App Context data without paging through every record.
* [API limits](https://www.pubnub.com/docs/architecture/limits.md). Limits across every PubNub API, including Publish, Subscribe, and [Presence](https://www.pubnub.com/docs/presence/overview.md).

Last updated at: 2026-09-30T07:20:08.000Z
