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

# Provider Onboarding

> As a party, request to be onboarded as a provider. As a provider, define the credential requirements for onboarding registrars.

The Provider role gives a party the right to grant other parties the Registrar role, as described
in the [Roles page](https://docs.digitalasset.com/registry/get-started/role-architecture.md#application-roles).

## Overview

1. A party requests a Provider Service from the operator.
2. The operator accepts or rejects the request. On acceptance, the Registry App checks that the
   party satisfies the operator's provider requirements. If accepted, a `ProviderService` contract
   is created, onboarding the party as a provider.
3. The provider creates a Provider Configuration contract defining the requirements that
   parties must satisfy to be onboarded as registrars.

The provider requirements are based on credential contracts. A credential proves that a party
satisfies a specific claim, for example that it is authorized to act as a registrar for the provider.

```mermaid theme={null}
flowchart LR
  P(["Party"]) -- "Request\nProvider Service" --> RQ["ProviderServiceRequest"]
  RQ -- "Operator accepts" --> V{"Provider\nrequirements\nsatisfied?"}
  V -- "Yes" --> PS["ProviderService"]
  V -- "No" --> F["Acceptance fails"]
  RQ -- "Operator rejects" --> RJ["Request rejected"]
  RQ -. "Party cancels" .-> C["Request cancelled"]
  PS -- "Provider creates" --> PC["Provider Configuration\n(registrar requirements)"]
```

> [!TIP]
>
> You can jump straight to a section: [Request](#request-a-provider-service) ·
> [Create](#create-a-provider-configuration) · [Modify](#modify-a-provider-configuration) ·
> [Troubleshooting](#troubleshooting).

## Prerequisites

* If the operator defines provider requirements, the party must hold the required credentials,
  usually a credential offered directly by the operator party.
* To define registrar requirements, the credential issuers and claims must be agreed.

Requirements are evaluated as described in [How Requirements Are Evaluated](https://docs.digitalasset.com/registry/guides/instrument-configuration.md#how-requirements-are-evaluated).

## Request a Provider Service

> [tab] dApp UI
>
> Go to **Onboarding** and, in the **Services** tab, click **Request Provider Service**.
>
> The request is shown in the **Requests** tab until the operator accepts or rejects it. Once
> accepted, the Provider Service is shown in the **Services** tab. On DevNet, Provider Service
> requests are accepted automatically.

> [tab] API
>
> Create a `ProviderServiceRequest` contract
> (`#utility-registry-app-v0:Utility.Registry.App.V0.Service.Provider:ProviderServiceRequest`)
> as the party:
>
> ```json theme={null}
> {
>   "operator": "<operator party ID>",
>   "provider": "<your party ID>"
> }
> ```
>
> You can get the operator party ID from the `GET /api/utilities/v0/operator` endpoint of the
> [Operator Backend API](https://docs.digitalasset.com/registry/apis/operator-backend-api.md).
>
> The operator accepts the request with `ProviderServiceRequest_Accept`, which creates your
> `ProviderService` contract, or rejects it with `ProviderServiceRequest_Reject` and a reason.
> Until then, you can cancel the request with `ProviderServiceRequest_Cancel`.

> [!NOTE]
>
> App rewards: the operator sets how app rewards are split between the operator and the provider,
> through the `AppRewardConfiguration` it creates when accepting the request. Only the operator can
> change it. You can split your own share per instrument, see
> [Provider Reward Beneficiaries](https://docs.digitalasset.com/registry/guides/instrument-configuration.md#provider-reward-beneficiaries).
> With CIP-104, traffic-based app rewards will replace this setup, see
> [CIP-104 Guidance](https://docs.digitalasset.com/registry/guides/cip-104-guidance.md).

## Create a Provider Configuration

> [tab] dApp UI
>
> 1. Go to **Onboarding** and create a provider configuration.
> 2. Under the registrar requirements, add a credential requirement: enter the credential
>    issuer's party ID, and add the required claims (property and value).
> 3. Submit the configuration.

> [tab] API
>
> The provider creates the configuration from its `ProviderService` contract.
>
> ```mermaid theme={null}
> sequenceDiagram
>   autonumber
>   actor P as Provider
>   participant LP as Provider's JSON Ledger API
>
>   P->>LP: Query the active ProviderService contract
>   LP-->>P: ProviderService contract ID
>   P->>LP: Exercise ProviderService_CreateProviderConfiguration
>   LP-->>P: ProviderConfiguration contract ID
> ```
>
> As the provider, exercise `ProviderService_CreateProviderConfiguration` on your
> `ProviderService` contract:
>
> ```json theme={null}
> {
>   "registrarRequirements": [
>     {
>       "issuer": "<credential issuer party ID>",
>       "requiredClaims": [{ "_1": "hasRegistryRole", "_2": "Registrar" }]
>     }
>   ],
>   "holderRequirements": []
> }
> ```
>
> `requiredClaims` uses the Daml tuple encoding `{"_1": <property>, "_2": <value>}`.
> `holderRequirements` is deprecated and must be `[]`, otherwise the choice fails.

> [!TIP]
>
> If no registrar requirements are defined, the provider can onboard any party as a registrar
> without credentials. The provider still retains control because it must explicitly accept each
> Registrar Service request.

## Modify a Provider Configuration

> [tab] dApp UI
>
> On the **Onboarding** page, modify the provider configuration and submit the changes.

> [tab] API
>
> As the provider, exercise `ProviderService_ArchiveAndCreateProviderConfiguration` to replace the
> configuration, or `ProviderService_ArchiveProviderConfiguration` to remove it.

Changes only apply to requests accepted afterwards. Existing Registrar Services are not affected.

## Troubleshooting

| Symptom | Cause | Resolution |
| :- | :- | :- |
| `Subject [...] must have credentials for: [...]` when the operator accepts a Provider Service request | The party doesn't satisfy the operator's provider requirements. | Obtain the required credential, for example from the operator, and request the Provider Service again. |
| `Subject [...] must have credentials for: [...]` when accepting a Registrar Service request | The requesting party doesn't satisfy the registrar requirements. | Issue the missing credential to the party, see [How Requirements Are Evaluated](https://docs.digitalasset.com/registry/guides/instrument-configuration.md#how-requirements-are-evaluated). |

## Next steps

* To onboard registrars, see [Registrar Onboarding](https://docs.digitalasset.com/registry/guides/registrar-onboarding.md).
