# Magistrate

Magistrate turns a location rule into a decision you can check. You describe the rule in the [Magistrate studio](https://magistrate.octetproof.com/), for example "only users in Austria" or "nobody in a country under embargo". Magistrate decides each request against that rule, using location proofs from the Octet Mobile SDK, and returns a signed answer.

:::warning[You enforce the decision]

Octet decides and signs. It does not block, allow or change anything in your app or on your servers. Your backend verifies the signed answer and decides what happens to the request. If your backend ignores the answer, nothing is enforced.

:::

## The parts

| Part | What it is | Who uses it |
|---|---|---|
| **Magistrate studio** | The web app at [magistrate.octetproof.com](https://magistrate.octetproof.com/) where you write, review and sign a policy | Your product, risk or compliance owner |
| **OPL** | The Octet Policy Language. Every policy the studio writes is an OPL policy, and you can read it in the studio's code pane | Anyone who reviews a policy |
| **Octet policy engine** | Octet's service that holds your signed policy and decides each request against it | Nobody directly. The Magistrate module and your backend talk to it |
| **Magistrate module** | A library for iOS and Android that sits on top of the Octet Mobile SDK and asks the engine for a decision | Your app developers |
| **Decision receipt** | The engine's signed copy of each decision | Your backend developers |

## The answer

Each policy asks one question about where the device is, such as "Is the device in Austria?". The studio shows the answer as **YES**, **NO** or **UNKNOWN**. The engine returns it as `permit` or `deny`, and adds a `cause` when the location could not be settled. [Decision Response](/docs/magistrate/reference/decision/) shows how the two map.

UNKNOWN is never a guess. When the proofs can't settle the question, the policy decides with its fail-safe answer, which is `deny` for every policy the studio writes.

## Get started

1. [Write a policy in Magistrate](/docs/magistrate/get-started/write-a-policy/).
2. Add the Magistrate module to your [iOS](/docs/magistrate/get-started/ios/) or [Android](/docs/magistrate/get-started/android/) app.
3. [Verify and enforce the decision](/docs/magistrate/get-started/verify-and-enforce/) on your backend.

To read or review a policy, start with the [OPL overview](/docs/magistrate/opl/overview/). For how a request travels through the system, see [How It Works](/docs/magistrate/how-it-works/).

:::note[Preview]

The Magistrate module for iOS and Android is in preview. The API on these pages is the one version 0.1.0 will ship.

:::
