> 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/restrict-jurisdictions.md). Agents can also search and read this documentation through its [MCP server](https://docs.metamynd.ai/~gitbook/mcp).

# Restrict Jurisdictions

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

A mandate can say *where* an agent may act, not only how much it may spend. The gate enforces that on a jurisdiction it can trust: a country **you** registered for the payee, or one the agent **signed** into its request. A jurisdiction the agent merely mentions in its unsigned context is ignored.

Normative text: MAGP spec §5.2.3 (the mandate term), §5.4.5 (delegation), §8.3.12 (the signed field), §8.5 (where the gate judges it) and §10.4.1 (approvals).

#### How the gate decides

For every authorize request the gate works out one **effective jurisdiction**, in this order:

1. **The payee's registered country.** If you registered the request's `merchant` in your payee directory with a country, that country is the effective jurisdiction. It is authoritative. It also counts when the agent signed nothing.
2. **The signed `jurisdiction`**, a top-level ISO 3166-1 alpha-2 code the agent's SDK signs into the request.
3. **None.**

That one value is what the mandate's allowed-jurisdictions list and any `jurisdiction-not-allowed` SOP or Standard rule are judged on. An `itinerary.jurisdiction` / `mm:jurisdiction` is removed before any check runs.

#### Owner: set the list on the mandate

In the dashboard, go to **Agents → Deploy Agent** (the Launchpad). In the Authority step, enter **Allowed jurisdictions (optional)** (ISO codes; `EU` is a shortcut for the member states). Leave it blank for no restriction. The agent's Trust Profile shows the issued list on its **Authority** tab, under **Allowed jurisdictions**. Through the API, pass `allowedJurisdictions` when you issue the mandate:

```http
POST /policy/mandate
{
  "agentDid": "did:hedera:testnet:…",
  "scope": "flight-purchase",
  "maxAmount": 10000,
  "currency": "USD",
  "allowedJurisdictions": ["SG", "MY", "EU"]
}
```

* Codes are trimmed, upper-cased, de-duplicated and sorted. `EU` expands to the 27 member states. An empty or malformed list is `400 MALFORMED_REQUEST`. Leave the field out for no restriction.
* The list is stored on the mandate as `{ "leftOperand": "mm:jurisdiction", "operator": "isAnyOf", "rightOperand": [...] }`. `GET /policy/mandate/{ref}/status` returns it as `allowedJurisdictions` (`null` means no restriction).
* **Delegation:** a delegated mandate that states no list inherits yours, and the inherited list is stored on it. A list it states must be a subset of yours, or the delegation is refused `CONSTRAINT_WIDENED`.
* **Reissues** (key rotation, resource-scope pin, payload-binding toggle, a change to the spending limits or the expiry) carry the list over. They never drop it.
* The zero-knowledge path proves membership in this same list. See [Commitments & Bulletproofs](https://docs.metamynd.ai/zero-knowledge/commitments-and-bulletproofs).

#### Owner: a jurisdiction rule in an SOP or Standard

A `jurisdiction-not-allowed` rule is an allow-list: list the ISO codes the agent may act in (`GB`, not `United Kingdom` or `UK`) and use the combinator **all**. `EU` stands for the 27 member states, as on the mandate (agentsafe-guard 0.34.2 / agentsafe-mcp-guard 0.29.2 / agentsafe-a2a-guard 0.19.2 and the gate; before them it matched only a request that literally signed `EU`). It fires on a signed jurisdiction that is not on the list; a request that signs none is refused `JURISDICTION_REQUIRED`.

Don't wrap it in **none**. That inverts it: the rule then fires on the listed jurisdictions (and on a missing one) and lets every other country through. The SOP compiler and the Standards AI draft refuse both mistakes. A hand-written Standard may use **none** as a deliberate deny-list, and the rule builder says so. An SOP approved before these checks shows the problem on a testnet agent's Trust Profile (**Overview** tab) under **See each outcome before going live**. Recompile it to fix it.

#### Owner: register payee countries (optional, recommended)

A country you register for a payee beats anything the agent says. Registering one takes the question away from the agent for that merchant. In the dashboard, open **Authority & Controls → Trusted Counterparties** and use the **Merchant payee accounts** card: set a country on the add form, or edit or clear it per merchant. Through the API:

```http
POST /policy/payees                 { "merchant": "skyward-air", "payTo": "0.0.4321", "country": "SG" }
PUT  /policy/payees/country         { "merchant": "skyward-air", "country": "SG" }    // or null to clear it
```

* The country belongs to the merchant, so every active entry for that merchant carries the same one. On `POST`, leaving out `country` keeps the merchant's current country. `PUT` sets it on all of them, and answers `404` when the merchant has no active entry. A malformed code, or a group code such as `EU`, is `400 MALFORMED_REQUEST`.
* A payee entry needs an account (`payTo`), and registering one also switches on the payee check for lowered settlements for that merchant (`PAYEE_NOT_REGISTERED`). See [Register Trusted Counterparties & Payee Accounts](https://docs.metamynd.ai/guides/register-trusted-counterparties-and-payee-accounts).
* A change applies at the next decision, including the approval of a review that is already pending.

#### Agent: sign the jurisdiction

Pass `jurisdiction` as its own argument. Don't put it in `context`, because the gate ignores it there.

**Node** (`@metamynd/agentsafe-guard` ≥ 0.16.0):

```js
const d = await guard.authorize({
  action: 'flight-purchase', amount: 150, currency: 'USD', merchant: 'skyward-air',
  jurisdiction: 'SG',                      // signed; 'sg' is normalised to 'SG'
  context: { tool: 'book-flight', riskLevel: 'low' },
});
```

**Python** (`metamynd-client` ≥ 0.6.0):

```python
v = client.authorize("flight-purchase", 150, "USD", merchant="skyward-air",
                     jurisdiction="SG", context={"tool": "book-flight", "riskLevel": "low"})
if v.jurisdiction_refused:
    ...  # JURISDICTION_REQUIRED / _NOT_ALLOWED / _MISMATCH; resending the same request will not help
```

`guardTool` / `guard_tool` take it from `mapArgs` / `map_args` as a top-level `jurisdiction`. A value that is not two ASCII letters is refused locally and nothing is sent.

With the field, the request is signed over the v2 message (`…|issuedAt|MAGP-AUTH-v2|<jurisdiction>`). Without it, the request is the v1 message byte for byte, so nothing changes for an agent that doesn't send one.

#### SDK minimum versions

| Package                            | Minimum | What it adds                                                                                                                                                          |
| ---------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `@metamynd/agentsafe-guard`        | 0.16.0  | `jurisdiction` on `authorize`, `buildSignedRequest`, `guardTool`, `evaluateLocally`. Also `normalizeJurisdiction` and `JURISDICTION_REASON_CODES`                     |
| `metamynd-client` (Python)         | 0.6.0   | `jurisdiction=` on `authorize`, `sign_request`, `guard_tool`. Also `normalize_jurisdiction` and `Verdict.jurisdiction_refused`                                        |
| `@metamynd/agentsafe-signer`       | 0.18.0  | The daemon signs v2 and echoes the field. With an older daemon the clients refuse `JURISDICTION_SIGNING_UNSUPPORTED` rather than send a request the gate would reject |
| `@metamynd/agentsafe-mcp-guard`    | 0.16.0  | `verifyRequest` verifies v2 and judges the signed value only                                                                                                          |
| `@metamynd/agentsafe-a2a-guard`    | 0.10.0  | Same, for A2A envelopes (`buildA2AEnvelope(guard, { jurisdiction })`)                                                                                                 |
| `@metamynd/agentsafe-http-gateway` | 0.14.0  | mcp-guard ≥ 0.16.0. Nothing to configure                                                                                                                              |
| `create-metamynd-agent`            | 0.13.0  | Scaffolded agents pass `jurisdiction` top-level                                                                                                                       |

A counterparty on an older mcp-guard or a2a-guard can't verify a request that carries the field, and fails it `SIGNATURE_INVALID`. Upgrade services before agents start signing.

#### Refusals

All three are hard blocks, and none of them can be turned into a human review.

| Code                       | Why                                                                                                                                                                                              | Fix                                                                                    |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| `JURISDICTION_REQUIRED`    | The request has no effective jurisdiction, but one is needed: the mandate restricts jurisdictions, or the agent is bound to an enforced SOP/Standard rule that judges `jurisdiction-not-allowed` | Sign `jurisdiction` (upgrade the SDK), or register the payee's country                 |
| `JURISDICTION_NOT_ALLOWED` | The effective jurisdiction is not on the mandate's list                                                                                                                                          | Intended. Widen the list by issuing a new mandate if the action should be allowed      |
| `JURISDICTION_MISMATCH`    | The agent signed a country that differs from the one you registered for the payee, or the payee's entries name two countries                                                                     | Correct the agent or the registry. This fires even when the mandate has no restriction |
| `MALFORMED_REQUEST`        | The signed value is not two letters                                                                                                                                                              | Send an ISO 3166-1 alpha-2 code                                                        |
| `SIGNATURE_INVALID`        | The field was added, changed or stripped after signing, or a verifier predates v2                                                                                                                | Sign it through the SDK, and upgrade the verifier                                      |

At approval, the gate resolves the jurisdiction again from the value stored with the review and the registry as it stands then. If there is no effective jurisdiction at that point (a review opened before the signed value was stored, or a registered country that has since been cleared), the approval is refused `APPROVAL_INPUT_UNAVAILABLE`.

#### Compatibility

A mandate with no allowed-jurisdictions list, for an agent bound to no enforced jurisdiction rule, behaves exactly as before, for old and new SDKs. The one exception is an agent that **signs** a country contradicting the one you registered for the payee: that request is refused `JURISDICTION_MISMATCH`. After this change, two groups of agents are refused `JURISDICTION_REQUIRED` until they either upgrade to a signing SDK or pay a payee with a registered country:

* agents under a mandate that restricts jurisdictions, and
* agents bound to an enforced jurisdiction rule, such as the onboarding **Compliance (jurisdiction + data)** rule pack.

Local pre-checks (`evaluateLocally`, `guardToolLocal`, the mcp-guard and a2a-guard `verifyRequest`) mirror `JURISDICTION_REQUIRED` and `JURISDICTION_NOT_ALLOWED`. Only the gate can see the payee registry, so only the gate returns `JURISDICTION_MISMATCH`.


---

# 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/restrict-jurisdictions.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.
