# Sharing session data with partners

> How a CPO or an eMSP gives a partner its sessions and CDRs through Road, what the partner receives, and how to set it up.

A CPO or an eMSP on Road can give a partner its sessions, and optionally their CDRs, through a data sharing permission. The partner receives them over OCPI even though it did not authorise them, which lets a smart charging provider follow the sessions on the EVSEs it manages, or a navigation provider see how a network is used. The eMSP that issued the card still receives each session in full and bills it as usual.

## Who can share with whom

The party that owns the sessions grants the permission, and both parties need an active agreement on Road.

| Owner | Sessions it shares                              | Partners it can grant to                                                                                                                      |
| ----- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| CPO   | Sessions on its Locations                       | eMSP, payment terminal provider (PTP), national access point (NAP), navigation service provider (NSP), smart charging service provider (SCSP) |
| eMSP  | Sessions on its own cards, wherever they charge | CPO, smart charging service provider (SCSP)                                                                                                   |

A permission to receive sessions has the kind `OBSERVE_SESSIONS`.

## What a permission sets

The owner decides everything about what the partner receives. The field names are those of Road's data sharing endpoints.

| Setting         | Field             | Options                                                                                                                                                                                                                                       |
| --------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Scope           | `scope`           | For a CPO, all its Locations (`all`), or a list of its Locations and single EVSEs (`entries`). A list can be extended or trimmed later; an all-Locations scope cannot be edited. An eMSP uses `all`, which covers every session on its cards. |
| Driver identity | `identity_policy` | `PSEUDONYMISED`, the default, replaces each card with a code. `FULL` shows the card as its eMSP sent it. `PARTY_ONLY` shows only which eMSP issued the card.                                                                                  |
| Costs           | `cost_shared`     | Shared or left out.                                                                                                                                                                                                                           |
| CDRs            | `include_cdrs`    | Included or left out.                                                                                                                                                                                                                         |

With `PSEUDONYMISED`, the code for a card stays the same for every session under one permission, so the partner can tell that two sessions used the same card without seeing it. The same card gets a different code under another permission.

## How shared data arrives

Road pushes shared data to the partner, in the same way it sends sessions to the card's eMSP:

- Each session goes to the partner's OCPI Sessions endpoint when it is created and on every update.
- Each CDR goes to the partner's CDRs endpoint, when the permission includes CDRs.
- Requests to Road's own Sessions endpoint keep returning only sessions on the partner's own cards. Shared sessions arrive by push.
- The partner's connection must be live and expose the Sessions endpoint, and the CDRs endpoint when CDRs are included. Road does not push to a connection that lacks them.
- Partners on OCPI 2.1.1 receive pushes too. Creating and managing permissions through the API needs OCPI 2.2.1 or 2.3.0.

A shared CDR never contains signed meter data, because it carries the card's identity. Only the card's eMSP receives it.

## Setting it up

1. Agree the sharing with your partner. Both parties need an active agreement on Road, which the roaming team can set up at <roaming@road.io>.
2. Create the permission. A CPO calls the data sharing endpoints on Road's [eMSP interface](/docs/roaming/reference/ocpi-221/emsp-data-sharing) and an eMSP on Road's [CPO interface](/docs/roaming/reference/ocpi-221/cpo-data-sharing). The counterparties endpoint lists the partners you can grant to. You can also ask the roaming team to set the permission up for you.
3. Make sure the partner exposes its Sessions endpoint, and its CDRs endpoint when CDRs are included.

The partner does not have to accept a permission, and Road does not notify it, so tell your partner when you grant one.

The same endpoints list permissions, change their scope and revoke them. They are described in the [OCPI 2.2.1](/docs/roaming/reference/ocpi-221) and [OCPI 2.3.0](/docs/roaming/reference/ocpi-230) references, marked with a **ROAD** badge.
