> ## Documentation Index
> Fetch the complete documentation index at: https://rollout.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Context fields

> What Rollout tells your app about the agent, the contact and the CRM on each launch.

Once you've [verified it](https://rollout.com/docs/embedded-apps/verify-the-context.md), the context tells
you who is looking at which contact, in which CRM. A decoded context looks like
this:

```json theme={null}
{
  "context": "person",
  "account": {
    "domain": "sawyer-realty",
    "owner": { "name": "Pat Broker", "email": "pat@example.com" }
  },
  "user": { "id": "AG123", "name": "Sawyer Agent", "email": "sawyer@example.com" },
  "person": {
    "firstName": "Melissa",
    "lastName": "Hartman",
    "stage": { "id": "12", "name": "Active Client" }
  },
  "crm": { "accountId": "site_123", "personId": "MM4X01" },
  "org": { "id": "site_123" },
  "x": {
    "platform": "cinc",
    "marketplaceId": "019a7c4e-…",
    "appId": "019a7c4f-…",
    "iat": 1762790400,
    "exp": 1762790700,
    "jti": "ctx_6f1d0c7e-…"
  }
}
```

## Fields

| Field | Always | Meaning |
| - | - | - |
| `context` | Yes | What the agent is looking at. Always `"person"` today. |
| `user.id` | Yes | The CRM's id for the agent viewing the contact. |
| `user.name`, `user.email` | No | The agent's name and email, as the CRM gives them. |
| `account` | No | The agent's CRM account: its `domain`, and its `owner`'s `name` and `email`. |
| `person` | No | The contact's `firstName`, `lastName` and `stage` (`id`, `name`), when the CRM gave them. `person.id` is set only if you [read CRM data with the Universal API](https://rollout.com/docs/embedded-apps/read-crm-data.md). |
| `crm.personId` | Yes | The CRM's id for the contact on screen. |
| `crm.accountId`, `org.id` | No | The CRM's id for the agent's org, such as an office, team or site. Both carry the same value. |
| `x.platform` | Yes | Which CRM the marketplace runs on, as a Rollout connector key, such as `cinc`. |
| `x.marketplaceId` | Yes | The marketplace your app was launched from. |
| `x.appId` | Yes | Your app's id in Rollout. |
| `x.iat`, `x.exp` | Yes | When the context was signed, and when it expires: five minutes later. In seconds since the epoch. |
| `x.jti` | Yes | A unique id for this context, for [replay checks](https://rollout.com/docs/embedded-apps/verify-the-context.md). |
| `x.preview` | No | `true` on a preview, whose agent and contact are made up. See [Previews](https://rollout.com/docs/embedded-apps/verify-the-context.md#previews). |

Treat any field not marked "Always" as optional, and ignore fields you don't
know: Rollout may add more.

The context never carries the contact's emails or phone numbers. To read them,
and the rest of the contact's data, use the
[Universal API](https://rollout.com/docs/embedded-apps/read-crm-data.md).

## Ids are unique per marketplace

The ids in `user`, `crm` and `org` are the CRM's own. They're unique within one
marketplace, not across marketplaces: two CRMs can both have an agent `AG123`.
Key everything you store by `x.marketplaceId` as well.

## Identifying the agent

`user.id` is stable for an agent within one marketplace. To recognize an agent
on later launches, link the pair (`x.marketplaceId`, `user.id`) to their account
in your app the first time they sign in:

```sql theme={null}
create table crm_agent_links (
  marketplace_id text not null,
  crm_user_id    text not null,
  your_user_id   text not null references users (id),
  primary key (marketplace_id, crm_user_id)
);
```

On each launch, look up the pair. If it's linked, show the app for that user.
If it isn't, ask the agent to sign in. See
[Signing agents in](https://rollout.com/docs/embedded-apps/build-the-page.md#signing-agents-in).

To group agents by team or office, use `org.id`, again together with
`x.marketplaceId`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.