> 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/get-started/register-trusted-counterparties-and-payee-accounts.md). Agents can also search and read this documentation through its [MCP server](https://docs.metamynd.ai/~gitbook/mcp).

# Register Trusted Counterparties & Payee Accounts

This guide is for the **owner** of an agent's mandate. It covers two owner-side controls in the dashboard, both under **Authority & Controls → Trusted Counterparties**:

{% embed url="<https://youtu.be/OYF6ITCo2FY>" %}

* **Trusted counterparties** — which services may *claim* your agents' holds, i.e. carry out the actions your agents are authorized to take.
* **Merchant payee accounts** — which accounts a merchant may be paid into when a service reports it charged *less* than was authorized.

Concepts: [Trusted Counterparties & Payee Directory](https://docs.metamynd.ai/core-concepts/trusted-counterparties-and-payee-directory).

#### Why the registry exists <a href="#user-content-why-the-registry-exists" id="user-content-why-the-registry-exists"></a>

When an agent is authorized to act, the service that carries the action out — your gateway, or the tool server an agent calls — **claims** the hold before executing. From then on, only that service can settle the hold below its amount, release it, or mark it unknown. A service can prove it controls a key (it signs its claims with its own `did:key` or `did:hedera`), but that doesn't say *you* trust it. The registry is where you say so.

#### Read the state first <a href="#user-content-read-the-state-first" id="user-content-read-the-state-first"></a>

The top of the page tells you which of three states your registry is in, because its meaning changes as you add and remove entries:

| Banner                         | Meaning                                                                                                                                                                                                                   |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Open — not restricted**      | You haven't registered a service, so any service that can prove it controls a key may claim your holds.                                                                                                                   |
| **Registered-only**            | Only the active services listed below may claim your holds. A claim from any other service, or one that doesn't identify itself, is refused and the hold stays claimable by a trusted service.                            |
| **Locked — no active service** | Every service you registered has been revoked. Revoking the last one does **not** reopen your holds: every claim is refused, so nothing your agents are authorized to do can execute, until you register a service again. |

{% hint style="warning" %} **Mainnet agents are always registered-only**, whatever this page shows. A hold for a mainnet agent can only be claimed by a service you've registered, so register your gateway before you launch a mainnet agent. The "Open" state applies to testnet agents only (and a deployment may choose to enforce the registry for every owner). {% endhint %}

#### Register a service <a href="#user-content-register-a-service" id="user-content-register-a-service"></a>

1. Get the service's DID from whoever runs it — for a MetaMynd gateway or MCP guard, its `serviceDid`. Only `did:key` and `did:hedera` are accepted, because the key must be inside the identifier. (A gateway scaffolded by `create-metamynd-agent` registers its own DID for you.)
2. In the **Register a service** card, fill in:
   * **Service DID** — e.g. `did:key:z6Mk…` or `did:hedera:testnet:…`
   * **Label** — optional, e.g. "Production gateway"
   * **Only for these merchants (optional)** — comma-separated. Leave it empty and the service may claim holds for any merchant. Scope it, and it may claim only holds for those merchants — a hold with no merchant can't be claimed by a scoped service.
3. **Have the service accept.** A service is registered only with its own signed consent, so nobody can name someone else's gateway as theirs. Under **The service must accept**, click **Get acceptance challenge**, give the challenge message to the service's operator to sign with the service key (with agentsafe-mcp-guard: `await guard.acceptCounterpartyChallenge(message)`), and paste the result into **Signature from the service (hex)** (128 hex characters). The challenge is valid for 10 minutes.
4. Click **Register**. It stays disabled until a valid signature for this DID is pasted.

**Your first registration asks for confirmation.** Registering your first service switches the registry on: from then on only the services you register can claim your holds — including any other gateway or tool server you run that is *not* this one. The dialog **Restrict your holds to registered services?** asks you to check the DID is the identity your gateway actually signs with; click **Register and restrict** to proceed. Later registrations don't ask again.

The service appears under **Registered services** with an **active** badge and a "may claim for:" line showing its merchant scope (or "any merchant").

**Services that don't claim**

The **Register a service** card registers services that claim. Two other kinds of entry appear in the same list, registered through the API (below):

* **Reports only · cannot claim**: an agent's own bundle-only gateway, which only reports what it did.
* **Observes only · cannot claim or report**: a monitoring service that signs facts about your systems, such as a service's health. Its row shows what it may attest, for example "may attest: health about svc:checkout · each valid up to 120 s". See <a href="https://docs.metamynd.ai/guides/govern-operations-with-attested-facts" target="_blank">Govern Operations with Attested Facts</a>.

Neither switches your registry to registered-only, and the banner counts only the services that claim.

#### Revoke a service <a href="#user-content-revoke-a-service" id="user-content-revoke-a-service"></a>

Click **Revoke** on an active row and confirm in the **Revoke …?** dialog.

* The service can no longer claim your holds.
* A hold it has **already** claimed stays claimed by it — it isn't reassigned (see the next section).
* If it's your **last** active service, the dialog warns you: revoking it doesn't reopen your holds to anyone; every claim is refused until you register a service again. Your registry moves to **Locked**.

The row stays in the list with a **revoked** badge and its revocation time.

#### Force a revoked service's holds into reconciliation <a href="#user-content-force-a-revoked-services-holds-into-reconciliation" id="user-content-force-a-revoked-services-holds-into-reconciliation"></a>

Revoking a service stops new claims, but can't take back one it already made — only the claimer can settle or release a claimed hold. If a revoked service still has claimed, unsettled holds, its row shows a box: **"N holds still claimed by this revoked service"**, listing each hold's id, amount, merchant and state.

To take a hold out of that service's hands:

1. Click **Force into reconciliation** on the hold.
2. Click **Confirm**.
3. The toast **"Hold moved to reconciliation"** confirms it, and the hold leaves the list.

What that does:

* The hold moves to `reconciling`, with you recorded as the actor.
* Its budget **stays committed** — nothing is released.
* The service loses every power over it: any capture or void it attempts is refused with `HOLD_UNDER_RECONCILIATION`, even at the full amount.
* It settles only on what the settlement observer establishes, or what a platform operator decides.

Nothing is released or reassigned because a hold that may already have executed must not run twice.

#### Merchant payee accounts <a href="#user-content-merchant-payee-accounts" id="user-content-merchant-payee-accounts"></a>

When a service settles a hold for **less** than was authorized, it has to name the account it paid (`payTo`). An observer can check that the named account was credited — but not that it's the *right* account for that merchant. The payee directory closes that gap, per merchant, and it's optional.

In the **Merchant payee accounts** card:

1. **Merchant** — the merchant name exactly as your mandates use it, e.g. `skyward-air`.
2. **Account it is paid into** — a Hedera account id (`0.0.X`) or an EVM address (`0x…`, 40 hex characters).
3. **Label** — optional, e.g. "Operating account".
4. Click **Add account**.

Accounts are grouped by merchant, and each merchant with at least one active account shows an **enforced** badge. From then on, a lowered settlement for that merchant must name one of its listed accounts, or it's refused.

* Add more than one account per merchant if it's paid into several.
* **Revoke** removes an account. Revoking a merchant's last account stops checking that merchant's settlements (the card tells you so).
* A merchant you haven't listed, and any settlement at the full authorized amount, are unaffected. With nothing listed, the card reads "No accounts registered — no merchant is constrained."

**A merchant's country**

You can also record the country a merchant is in (ISO 3166-1 alpha-2, e.g. `SG`). That country becomes the **authoritative jurisdiction** for requests paying that merchant. It satisfies a jurisdiction restriction even if the agent signed nothing, and an agent that signs a different country is refused `JURISDICTION_MISMATCH`. In the **Merchant payee accounts** card, set a country on the add form, or edit or clear it per merchant. The card warns you when a merchant's entries name more than one country. Through the API, use `PUT /policy/payees/country` (below). See <a href="https://docs.metamynd.ai/guides/restrict-jurisdictions" target="_blank">Restrict Jurisdictions</a>.

**What `PAYEE_NOT_REGISTERED` means**

A service tried to settle a hold for one of your listed merchants **below** the authorized amount, and the `payTo` it named isn't one of that merchant's active accounts (or it named none). The lowered settlement is refused; the service can still settle at the full amount. If the account is genuinely the merchant's, add it here; if it isn't, the refusal did its job.

`PAYEE_NOT_VERIFIED` means the directory couldn't be read at the time, so the lowered settlement was refused rather than let through unchecked.

#### Doing the same through the API <a href="#user-content-doing-the-same-through-the-api" id="user-content-doing-the-same-through-the-api"></a>

All of these routes are authenticated and scoped to the calling owner.

| Action                              | Route                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| List your registry                  | `GET /policy/counterparties`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Get a registration challenge        | `POST /policy/counterparties/challenge` `{ "did", "purpose"?: "claim" \| "report" \| "observe" }` → `{ message, challengeToken }`. The service signs `message` with its own key (`guard.acceptCounterpartyChallenge(message)` in `@metamynd/agentsafe-mcp-guard`).                                                                                                                                                                                                                                                                                                                                               |
| Register a service                  | `POST /policy/counterparties` `{ "did", "label"?, "merchants"?: [...], "purpose"?, "proof": { "challengeToken", "signature" } }`. The proof is required: without it the request is refused `COUNTERPARTY_PROOF_REQUIRED`, and with a bad one, or one signed for another purpose, `COUNTERPARTY_PROOF_INVALID`. Your first `claim` registration must also send `"confirmEnforcementChange": true`, or it's refused with `409 ENFORCEMENT_CHANGE_NOT_CONFIRMED`. A `report` or `observe` registration doesn't need that flag, because it can't claim. Registering an active entry again for less never narrows it. |
| Grant or clear an observation scope | `PUT /policy/counterparties/{id}/observation` `{ "subjects": [...], "facts": [...], "maxValiditySeconds"?: 1–600 }`. `"facts": []` clears it. See <a href="https://docs.metamynd.ai/guides/govern-operations-with-attested-facts" target="_blank">Govern Operations with Attested Facts</a>.                                                                                                                                                                                                                                                                                                                     |
| Revoke a service                    | `DELETE /policy/counterparties/{id}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| A revoked service's claimed holds   | `GET /policy/counterparties/{id}/claimed-holds`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Force a hold into reconciliation    | `POST /policy/mandate/authorize/{authorizationId}/effect/force-reconcile`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| List payee accounts                 | `GET /policy/payees`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Add a payee account                 | `POST /policy/payees` `{ "merchant", "payTo", "label"?, "country"? }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Set or clear a merchant's country   | `PUT /policy/payees/country` `{ "merchant", "country" }` (`null` clears it; `404` if the merchant has no active entry)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Revoke a payee account              | `DELETE /policy/payees/{id}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

#### What a service sees <a href="#user-content-what-a-service-sees" id="user-content-what-a-service-sees"></a>

| Code                                          | Why                                                                                  |
| --------------------------------------------- | ------------------------------------------------------------------------------------ |
| `COUNTERPARTY_NOT_REGISTERED`                 | Its DID isn't an active entry in your registry                                       |
| `COUNTERPARTY_AUTH_REQUIRED`                  | It claimed without identifying itself, and your registry is enforced                 |
| `COUNTERPARTY_NOT_ALLOWED_FOR_MERCHANT`       | Its entry is merchant-scoped and this hold's merchant isn't in scope                 |
| `COUNTERPARTY_MISMATCH`                       | A settlement call was signed by someone other than the service that claimed the hold |
| `HOLD_UNDER_RECONCILIATION`                   | You forced the hold into reconciliation                                              |
| `PAYEE_NOT_REGISTERED` / `PAYEE_NOT_VERIFIED` | See above                                                                            |

A refused claim leaves the hold unclaimed and claimable by a service you trust — nothing executed. The service-side view is in <a href="https://docs.metamynd.ai/guides/integrate-an-mcp-server" target="_blank">Integrate an MCP Server</a> and <a href="https://docs.metamynd.ai/guides/settle-a-claimed-hold" target="_blank">Settle a Claimed Hold</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/get-started/register-trusted-counterparties-and-payee-accounts.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.
