> ## 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.

# Read CRM data

> Use the Universal API to read the contact's emails, phones, notes and more from your embedded app.

The context tells you which contact the agent is looking at, but carries little
about them: a name and a stage, never their emails or phone numbers. If you
also use Rollout's Universal API, the context can carry the contact's Universal
API id as `person.id`, and you can read everything else through the API.

## When `person.id` is set

Rollout adds `person.id` to the context when all of these are true:

* One of your consumers has a live credential for the marketplace's CRM, whose
  credential key is the agent's id in that CRM, the context's `user.id`. This
  is usually because the agent connected their CRM account to your app through
  [Rollout Link](https://rollout.com/docs/getting-started/show-the-authentication-ui.md).
* That credential has synced the contact.
* The CRM's connector can map the CRM's id for a contact to its Universal API
  record. CINC's can.

Otherwise the context has no `person.id`. You still have `crm.personId`, the
CRM's own id. A contact created in the CRM moments ago may have no `person.id`
until the next sync reaches it.

## Read the contact

With `person.id`, fetch the contact from the Universal API, using the
credential the agent connected:

```ts theme={null}
const response = await fetch(
  `https://crm.universal.rollout.com/api/people/${ctx.person.id}`,
  {
    headers: {
      Authorization: `Bearer ${authToken}`,
      "x-rollout-credential-id": credentialId,
    },
  },
);
const person = await response.json();
```

`authToken` and `credentialId` are the same ones you use for any Universal API
request. See [Making API requests](https://rollout.com/docs/getting-started/making-api-requests.md).

From there you can read the contact's notes, tasks and other records, and write
back to the CRM, as with any Universal API credential. Don't write to a CRM on a
[preview](https://rollout.com/docs/embedded-apps/verify-the-context.md#previews).


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