> For the complete documentation index, see [llms.txt](https://docs.openg2p.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openg2p.org/products/open-agri-stack/administration/releasing-data-to-the-composite.md).

# Releasing Registry Data to the Composite

What a department's registry releases to the Composite.

Each department decides what its registry releases to the Composite (the Exchange's service that partners query): the Composite's scope policy for the registry, in the department's own Partner Management. Until the department adds it, the registry releases nothing to the Composite. The department owns this policy: the Exchange's operator should hold no Partner Management admin rights in a department. Why and how it is applied: [Scope policy for the Composite](https://docs.openg2p.org/products/open-agri-stack/architecture/data-sharing-policies.md#what-actually-gets-released) and [Data-Sharing Policies](https://docs.openg2p.org/products/open-agri-stack/architecture/data-sharing-policies.md).

Step 3 of the [install steps](https://docs.openg2p.org/products/open-agri-stack/deployment.md#install-steps), and again whenever use cases change. Done by the department's partner manager, in the department's Partner Management (`https://partner-management.<department domain>`).

## The Composite's entry

Installing a department with **Exchange Role** `department` (in Commons Services) onboards the Composite as a partner in the department's Partner Management by default:

* partner ID `PARTNER_AGRI_COMPOSITE`;
* its public keys read from the Composite's JWKS URL whenever needed, so no key is entered by hand;
* **no policy**: it releases nothing until you add one below.

The install raises and approves this onboarding itself (actor `bootstrap` in the Partner Management audit). More: [what the install sets up](https://docs.openg2p.org/products/open-agri-stack/deployment.md#what-the-install-sets-up). Check it is there:

```bash
curl -s https://partner-management-partner-api.<department domain>/keys/PARTNER_AGRI_COMPOSITE
```

It serves the same `kid` as `https://agri-composite.<Exchange domain>/.well-known/jwks.json`. If the partner is missing (the setting was off, or the entry was removed), onboard it by hand: **Partners → + Onboard partner**:

| Field                                                 | Value                                                            |
| ----------------------------------------------------- | ---------------------------------------------------------------- |
| Partner ID                                            | `PARTNER_AGRI_COMPOSITE`                                         |
| Name                                                  | e.g. `Agri Stack Composite`                                      |
| Public keys                                           | None                                                             |
| JWKS URL                                              | `https://agri-composite.<Exchange domain>/.well-known/jwks.json` |
| Read keys from this JWKS URL whenever they are needed | **On**                                                           |
| Policies                                              | None                                                             |

**Submit request**, then approve it (another person, in production). If the partner exists but serves no key, Partner Management cannot reach the JWKS URL.

## What the use cases read from the registry

The Composite lists each published use case and the scopes it reads from each registry:

```bash
curl -s https://agri-composite.<Exchange domain>/composite/v1/use-cases
```

For each use case, `consent_scopes` gives the registry's scopes (`required` and `optional`) and `purpose` its purpose. The policy must cover every use case the department agrees to: the union of their scopes, and their purposes.

## Add the policy

Partner **PARTNER\_AGRI\_COMPOSITE → Add policy → Data controller**:

| Field                        | Value                                                    |
| ---------------------------- | -------------------------------------------------------- |
| Data controller              | The registry, e.g. `farmer-registry`                     |
| Data scopes                  | The scopes the department releases, from those asked for |
| Purposes                     | The use cases' purposes, e.g. `credit-assessment`        |
| Subject ID types             | e.g. `FAYDA_FAN`, `FARMER_ID`                            |
| Signing algorithms           | `ES256` (the Composite's generated key)                  |
| Maximum validity, Fetch type | e.g. `P90D`, `oneshot`                                   |

Submit, then have another person approve the request (Partner Management allows the same person; avoid it in production). Review a widening before approving it. One policy per registry the department runs. Portal steps: [Creating and Changing Policies](https://docs.openg2p.org/platform/platform-services/partner-management/creating-and-changing-policies.md).

**Check:** `curl -s https://partner-management-partner-api.<department domain>/policies/PARTNER_AGRI_COMPOSITE` lists the policy; a query through the Composite then gets the registry's data ([Testing](https://docs.openg2p.org/products/open-agri-stack/deployment/testing.md)).

## When use cases change

* **A new use case, or one that reads more:** **Edit** the policy to add the scopes and purposes, if the department agrees. Until then the registry leaves out what the policy does not cover, and denies the source if it covers none of what is asked.
* **To release less:** **Edit** the policy to remove scopes. An optional scope then comes back `null` in the answers; a required one fails the source.
* **To stop releasing:** **Revoke** the policy. The registry then denies every query through the Composite.

Changes apply within the services' policy cache time (about a minute).

## A department added later

A department joining an Exchange that is already running installs its registry with **Exchange Role** `department` ([Separate Clusters: adding a department](https://docs.openg2p.org/products/open-agri-stack/deployment/separate-clusters.md#adding-a-department)), then adds this policy.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.openg2p.org/products/open-agri-stack/administration/releasing-data-to-the-composite.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
