> For the complete documentation index, see [llms.txt](https://docs.metamynd.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metamynd.ai/core-concepts/trusted-counterparties-and-payee-directory.md). Agents can also search and read this documentation through its [MCP server](https://docs.metamynd.ai/~gitbook/mcp).

# Trusted Counterparties & Payee Directory

A mandate says what an agent may do. It doesn't say **who may carry it out** or **where the money may go**. Those are separate questions, and an owner answers each with a registry:

| Registry                   | Answers                                                         | Checked at                            |
| -------------------------- | --------------------------------------------------------------- | ------------------------------------- |
| **Trusted counterparties** | Which executing services may claim this owner's holds?          | The claim                             |
| **Payee directory**        | Which accounts may a merchant's lowered settlement say it paid? | A capture below the authorised amount |

Both are owner-scoped: an owner manages only their own entries, and no tenant can register a service into another tenant's registry. Both are managed in the dashboard under **Trusted Counterparties** (`/dashboard/counterparties`), which also holds the **Merchant payee accounts** card.

#### Why authenticating the executor isn't enough <a href="#user-content-why-authenticating-the-executor-isnt-enough" id="user-content-why-authenticating-the-executor-isnt-enough"></a>

The service that executes an agent's action signs its claim with its own DID — the `MAGP-SERVICE-v1` message (see <a href="https://docs.metamynd.ai/core-concepts/holds-claims-and-exactly-once-execution" target="_blank">Holds, Claims & Exactly-Once Execution</a>). That proves the claimer **controls a key**. It does not prove the key belongs to a service the owner trusts: an agent could claim its own hold under a key of its own. And the claimer is the one party that may later settle the hold lower, release it, or mark it unknown — so who gets to be the claimer matters.

#### Trusted counterparties: who may claim <a href="#user-content-trusted-counterparties-who-may-claim" id="user-content-trusted-counterparties-who-may-claim"></a>

An owner registers the DIDs of the services allowed to claim their holds (`GET | POST /policy/counterparties`, `DELETE /policy/counterparties/{id}`). An entry must be a self-verifying `did:key` or `did:hedera` — the only kinds a signed claim can be checked against — and may name the merchants it may act for; an entry naming none may claim for any merchant.

**When the registry is enforced:**

| Situation                                          | Who may claim                                                                           |
| -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| The hold's agent is a **mainnet** identity         | **Always** registered counterparties only — whatever the owner has or hasn't registered |
| The owner has **any** entry, of any status         | Registered, active counterparties only                                                  |
| Testnet agent, owner has never registered anything | Any authenticated counterparty (open)                                                   |
| The deployment requires registration for everyone  | Registered counterparties only                                                          |

Scoping enforcement to mainnet by default protects real settlement without adding friction to the testnet sandbox every new integration starts in. On testnet it is opt-in: registering your first entry is the opt-in.

**Rules at the claim, under enforcement:**

* An anonymous claim (no service identity) is refused — `COUNTERPARTY_AUTH_REQUIRED`.
* A claimant that isn't an active entry is refused — `COUNTERPARTY_NOT_REGISTERED`.
* A merchant-scoped entry may claim only holds for its merchants; a hold with no merchant can't satisfy a scoped entry — `COUNTERPARTY_NOT_ALLOWED_FOR_MERCHANT`.
* A registry that cannot be read is an error, never "no registry".

A refused claim leaves the hold unclaimed, so a trusted counterparty can still claim it.

**Two deliberate safety properties:**

* **The first registration must be confirmed.** Registering an owner's first entry flips **every** one of their holds from open to registered-only, which could silently strand an existing integration that was never registered. So a first registration without `confirmEnforcementChange: true` is refused (`409`, `ENFORCEMENT_CHANGE_NOT_CONFIRMED`). The dashboard shows a confirmation dialog before sending it.
* **Revoking the last entry does not reopen anything.** Once an owner has registered, enforcement fails closed: revoking every entry stops all claims until an entry is registered again, rather than quietly returning the owner's holds to "anyone may claim".

The gateway scaffolded by `create-metamynd-agent` gets its own service identity and registers it as a trusted counterparty for you during provisioning.

#### What an entry may do: its purpose <a href="#user-content-what-an-entry-may-do-its-purpose" id="user-content-what-an-entry-may-do-its-purpose"></a>

Each entry is registered for a **purpose**, and the service signs its acceptance for that purpose:

| Purpose               | May                                                                                                                  | Makes your holds registered-only |
| --------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `claim` (the default) | claim and settle your holds, and report what it did                                                                  | yes                              |
| `report`              | only report what it did: an agent's own bundle-only gateway (MAGP §16.4). It never claims.                           | no                               |
| `observe`             | only attest facts about your systems, within an observation scope you grant. It claims, settles and reports nothing. | no                               |

Registering an active entry again for a lesser purpose never narrows it: a `claim` entry stays `claim` (claim > report > observe).

**Observation scope.** Any entry, whatever its purpose, can be given an observation scope: the targets it may speak about, the fact names it may attest, and the longest each fact may be relied on (`PUT /policy/counterparties/{id}/observation`). It then becomes an **observer**, whose signed facts rules can require (see <a href="https://docs.metamynd.ai/core-concepts/attested-environment-facts" target="_blank">Attested Environment Facts</a>). A scope can't be given to one of your own agents' DIDs (`OBSERVER_IS_AGENT`). The registry lists each entry's scope as `observation`, and the dashboard shows "may attest: … about …".

#### Revoking a counterparty that already holds claims <a href="#user-content-revoking-a-counterparty-that-already-holds-claims" id="user-content-revoking-a-counterparty-that-already-holds-claims"></a>

Registration governs who may **claim**. A hold already claimed stays with its claimer: revoking that counterparty doesn't transfer the hold, because the action may already be executing and must not run twice.

For that case the owner has a direct remedy:

1. List the holds the revoked counterparty has claimed under your mandates that are still unsettled: `GET /policy/counterparties/{id}/claimed-holds` (the dashboard shows these on the counterparty).
2. **Force each into reconciliation**: `POST /policy/mandate/authorize/{authorizationId}/effect/force-reconcile`. The hold moves to `reconciling` with you as the actor, its budget stays committed, and the claimer loses all of its powers over it — no capture or void by the claimer applies, not even at the full amount (`HOLD_UNDER_RECONCILIATION`). It settles only on what the settlement observer establishes or an operator decides.

Only the mandate's owner or an admin can force reconciliation.

#### The payee directory: where the money went <a href="#user-content-the-payee-directory-where-the-money-went" id="user-content-the-payee-directory-where-the-money-went"></a>

When the claimer settles a hold **below** the authorised amount, it names the account it paid (`payTo` — a Hedera account id `0.0.X` or an EVM `0x` address). For x402-bound holds an independent observer then checks that account really was credited. But that proves *the named account was paid*, not that it is *the right account*: a registered service could name any account it controls.

The payee directory closes that for the merchants an owner chooses (`GET | POST /policy/payees`, `DELETE /policy/payees/{id}`):

* **Opt-in per merchant.** Registering the first account for a merchant starts enforcement for that merchant.
* **For a merchant with an active entry**, a lowered settlement must name one of its registered accounts, or it is refused — `PAYEE_NOT_REGISTERED`.
* **Fail closed on lookup errors.** If the directory can't be read, the lowered settlement is refused (`PAYEE_NOT_VERIFIED`) rather than the check being skipped.
* **Unaffected:** a merchant with no entries, and any settlement at the full authorised amount (which can only spend more).
* **Revoking a merchant's last entry ends enforcement for that merchant** — unlike the counterparty registry, the directory is purely additive protection per merchant.

`payTo` is sent with the capture (`captureAuthorization({ ..., payTo })` in the Node guards, `client.capture(auth_id, amount, pay_to=...)` in Python 0.5.2+). It is not one of the signed fields; the gate reads it only after the caller has been proven to be the claimer.

#### A payee's country: the authoritative jurisdiction <a href="#user-content-a-payees-country-the-authoritative-jurisdiction" id="user-content-a-payees-country-the-authoritative-jurisdiction"></a>

An owner can also register the **country** a merchant is in: `country` on `POST /policy/payees`, or `PUT /policy/payees/country { merchant, country | null }` to set or clear it on every active entry for that merchant. The country is per merchant, and it is an ISO 3166-1 alpha-2 code (a group code such as `EU` is refused).

Once registered, that country is the **effective jurisdiction** of every authorize request paying the merchant under that owner's mandates (MAGP §8.3.12):

* It counts even when the agent signed no jurisdiction, so the payee satisfies a mandate's `allowedJurisdictions` or an enforced jurisdiction rule on its own.
* A **signed** jurisdiction that differs from it is refused `JURISDICTION_MISMATCH`, a hard block. This applies even under a mandate with no jurisdiction restriction. Entries for one merchant that name two countries are refused the same way.
* It is read at every decision, so a change also applies to the approval of a review that is already pending.
* The decision record's `jurisdiction` control names the source (`registered` or `signed`).

A merchant with no country on record falls back to the jurisdiction the agent signed. See <a href="https://docs.metamynd.ai/guides/restrict-jurisdictions" target="_blank">Restrict Jurisdictions</a>.

#### Where to go next <a href="#user-content-where-to-go-next" id="user-content-where-to-go-next"></a>

* <a href="https://docs.metamynd.ai/guides/register-trusted-counterparties-and-payee-accounts" target="_blank">Register Trusted Counterparties & Payee Accounts</a> — the dashboard steps.
* <a href="https://docs.metamynd.ai/agent-protocol/settlement-and-settlement-evidence" target="_blank">Settlement & Settlement Evidence</a> — lowered settlements, observers and `settlementEvidence`.
* <a href="https://docs.metamynd.ai/guides/govern-operations-with-attested-facts" target="_blank">Govern Operations with Attested Facts</a> — registering an observer and granting its scope.
* The protocol text: <a href="https://metamynd.ai/developers/spec" target="_blank">MAGP §6.4, §8.7.6, §8.7.10, §8.7.13–8.7.14</a>.

<br>


---

# 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.metamynd.ai/core-concepts/trusted-counterparties-and-payee-directory.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.
