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

# Partners in Matcher

> Confine a partner's Matcher credential to the reconciliation contexts and sources you choose, tell it how to name them, and read the refusals it receives.

A [partner](https://docs.lerian.studio/en/platform/access-manager/features/partners/overview) can call Matcher with its own credential. In Matcher, you confine that credential to some reconciliation contexts and, inside a context, to some sources. This page shows how to choose that scope, what it reaches, and what the partner receives when it goes outside it.

Every Matcher partner needs a scope. A partner reads and operates inside its scope, but it does not configure: it cannot change contexts, sources, field maps, match rules, fee rules, or schedules.

## Step by step

***

**1. Choose the partner's contexts and sources**

Matcher has two restrictions. The **API field** is the `field` of a scope entry; the Console shows the name in the first column.

| Restriction | API field | What the partner reaches | What is refused |
| - | - | - | - |
| **Reconciliation context** (one or more values) | `contextId` | The listed contexts: reading them and their sources, field maps, match rules, schedules and fee rules, and operating them: file previews and import jobs, match runs and match groups, manual matches, adjustments, open items, rule suggestions, the exception list, reports, dashboards, and export jobs. The dashboard source breakdown shows every source of the context. All within what its permissions give. | The other contexts, listing, creating, or cloning contexts, changing the configuration of a context, and every route that does not name a context. |
| **Source** (one or more values, inside a context) | `sourceId` | The listed sources: reading them, previewing a file for them, and the reports, dashboards, and transaction search filtered by that source. | The other sources of the same context, the source list, the dashboard source breakdown (`…/dashboard/source-breakdown`), which shows every source of the context, and everything in the context that is not filtered by one of its sources, such as match runs, exceptions, and rules. |

The scope catalog lists the Matcher restrictions. Read it with [Retrieve a product's scope catalog](https://docs.lerian.studio/en/reference/platform/access-manager/retrieve-a-product-s-scope-catalog.md) for `matcher`.

Some rules apply to every scope:

* A request that does not name a context or a source of the scope is refused. For example, a partner cannot list the contexts of the tenant.
* A partner restricted to sources also needs the `contextId` entry with the context of those sources.

**2. Give the partner its permissions and scope**

Create the partner, or change it, in the [Console](https://docs.lerian.studio/en/platform/access-manager/features/partners/console.md) or with the [Identity API](https://docs.lerian.studio/en/platform/access-manager/features/partners/api.md). The product slug is `matcher`.

* Add the `contextId` scope entry, with one or more contexts, and the `sourceId` entry when you restrict the partner to sources. Without a scope, Access Manager refuses the partner with `400` and `IDE-1060`.
* Check the resources and actions. The most you can give is what the `matcher-editor` role holds in your tenant. Above that, Access Manager refuses with `IDE-1043`. For example, `fee-schedules` with `read` is above that role.

A partner receives only the permissions that act on a context or a source. A partner restricted to sources receives only the ones marked **source**:

| Resource | Actions on a context | Actions on a source |
| - | - | - |
| `contexts` | `read` | — |
| `sources` | — | `read` |
| `field-maps` | — | `read` |
| `rules` | `read` | — |
| `schedules` | `read` | — |
| `fee-rules` | `read` | — |
| `imports` | — | `preview` |
| `import-jobs` | `read` | — |
| `ingestion-transactions` | `ignore` | `search` |
| `match-runs` | `read`, `run` | — |
| `match-groups` | `read`, `unmatch`, `confirm` | — |
| `manual-matches`, `adjustments`, `rule-suggestions`, `open-items` | every action | — |
| `exceptions` | `read` | — |
| `reports`, `dashboards` | — | every action |
| `export-jobs` | `read` | `create` |

Most other Matcher permissions act on the whole tenant, and are never given to a partner, not even the read ones, such as `fee-schedules` with `read` or `audit-logs` with `read`. They are above the `matcher-editor` role, so Access Manager refuses them with `400` and `IDE-1043`. Some permissions act on a context or a source, but are above the `matcher-editor` role too: `contexts` with `clone`, `imports` with `create`, and `extraction-reviews` with `read` or `create`. So a partner cannot clone a context, upload or fetch a file, or extract a document. The writes that configure a context are above the `matcher-editor` role too: `contexts` with `update` or `delete`, `sources` with `create`, `update`, or `delete`, `field-maps` with `create`, `rules` with `create`, `update`, `delete`, or `reorder`, `fee-rules` with `create`, and `schedules` with `create`, `update`, or `delete`. A partner reads and operates, but it does not configure. Use an application of your own institution to configure a context.

**3. Create its Matcher application**

Create the partner's application with the product `matcher`. See [Create the partner's applications](https://docs.lerian.studio/en/platform/access-manager/features/partners/api.md#create-the-partners-applications) in the API guide, or [in the Console](https://docs.lerian.studio/en/platform/access-manager/features/partners/console.md#create-the-partners-applications). Send the client ID and the client secret to the partner through a secure channel.

**4. Tell the partner how to name its contexts and sources**

In most routes the partner reaches, the context is already in the path, in `/v1/contexts/{contextId}`, `/v1/imports/contexts/{contextId}`, `/v1/matching/contexts/{contextId}`, or `/v1/reports/contexts/{contextId}`, so the partner sends nothing extra. A few matching and exception routes name the context in the `contextId` query. Every value must be inside the partner's scope.

| Routes | Writes | Reads and routes by ID |
| - | - | - |
| Context and its configuration: `/v1/contexts/{contextId}`, `…/rules`, `…/schedules`, `…/fee-rules`, `…/field-maps`, `…/setup-progress` | None: refused to every partner | Path `contextId` |
| Sources: `/v1/contexts/{contextId}/sources/{sourceId}`, `…/bindings`, `…/field-maps` | None: refused to every partner | Path `contextId` and `sourceId` |
| Imports: `/v1/imports/contexts/{contextId}/sources/{sourceId}/…` | Path `contextId` and `sourceId` to preview a file | Path `contextId` for import jobs and the transaction search; query `source_id` filters the search by source |
| Matching: `/v1/matching/contexts/{contextId}/…` | Path `contextId` to run, and for rule suggestions | Path `contextId` for runs, adjustments, open items, and rule suggestions |
| Matching by ID: `/v1/matching/runs/{runId}`, `…/groups`, `/v1/matching/groups/{matchGroupId}`, `/v1/matching/candidates`, `/v1/matching/manual`, `/v1/matching/adjustments` | Query `contextId` to confirm or unmatch a group, match manually, or adjust | Query `contextId`, required for the partner |
| Rule simulation: `POST /v1/matching/simulate` | None: it reads | Body `contextId` |
| Exception list: `GET /v1/exceptions`, `GET /v1/exceptions/ids` | None: they read | Query `contextId`, required for the partner |
| Reports and dashboards: `/v1/reports/contexts/{contextId}/…` | None: they read | Path `contextId`; query `source_id` for a partner restricted to sources. The source breakdown (`…/dashboard/source-breakdown`) ignores `source_id`, so it is refused to a partner restricted to sources |
| Export jobs: `/v1/contexts/{contextId}/export-jobs` | Path `contextId`; body `sourceId` filters the export by source | Path `contextId` |

A record of another context, asked for under the path of one of the partner's contexts, answers `404`. Nothing is read, and the answer does not say which context the record belongs to.

> [!WARNING]
>
> These routes do not name a context, and are refused to every partner: listing and creating contexts (`GET /v1/contexts`, `POST /v1/contexts`), the routes of one exception or dispute (`/v1/exceptions/{exceptionId}/…`, `/v1/exceptions/bulk/…`, `/v1/disputes/…`), one export job (`/v1/export-jobs/…`), one fee rule (`/v1/fee-rules/{feeRuleId}`), one field map (`/v1/field-maps/{fieldMapId}`), and the routes of fee schedules, format templates, discovery, callback credentials, and governance. Use an application of your own institution for those routes.

A partner can create an export job in its context, but it cannot download the file, because the download route does not name the context. A partner can list the exceptions of its context, but it cannot open, assign, or resolve one exception.

**5. Confirm that it works**

This check assumes the partner has the `contexts` resource with the `read` action on Matcher, and a scope restricted to one or more contexts. Use the partner's credential. Read a context inside its scope. The answer is `200`:

```bash theme={null}
MATCHER_BASE_URL="https://your-matcher-host"             # your Matcher base URL
MATCHER_BEARER_TOKEN="paste-the-partner-access-token-here"
CONTEXT_ID="paste-a-context-id-in-the-scope-here"

curl -s -o /dev/null -w '%{http_code}\n' \
  -H "Authorization: Bearer ${MATCHER_BEARER_TOKEN}" \
  "${MATCHER_BASE_URL}/v1/contexts/${CONTEXT_ID}"
```

Send the same request with a context outside the scope. The answer is `403` with code `AUT-1020`.

## If something fails

***

| Code | Status | What it means | What to do |
| - | - | - | - |
| `AUT-1020` | 403 | The request is outside the partner's permissions or outside its scope, or it does not name a context or a source of the scope. | Check that the request names a context or a source of the partner's scope, in the path, in the `contextId` query, or in the `source_id` query. Check also that the partner has the permission for that route. |
| `MTCH-0004` | 403 | A matching route that needs the `contextId` query received none. | Send the `contextId` query with a context of the partner's scope. |
| `AUT-1009` | 401 | The partner is suspended. | Reactivate the partner. The same token works again. |
| `AUT-1010` | 401 | The request is outside the partner's validity window. | Change the validity window. |
| `AUT-0021` | 403 | The request comes from an address outside the partner's IP list, or your tenant's list when the partner has none. | Add the address to the partner's IP list. |

The answer does not say whether the permissions or the scope refused the request. This is on purpose: a partner cannot use a refusal to learn which contexts exist outside its scope.

For every other code, see the [Matcher error list](https://docs.lerian.studio/en/reference/products/matcher/matcher-error-list.md). For the refusals when you create or change a partner, see [Error codes](https://docs.lerian.studio/en/platform/access-manager/features/partners/api.md#error-codes) in the API guide.


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