# Agreements

Two parties confirming the same document with a passkey.

Related guide: [Two-sided agreements](https://provenanceauth.com/docs/mandate/guides/agreements.md)

## Endpoints

- `POST /v1/mandate/agreements`: [Create an agreement](#post-v1-mandate-agreements)
- `GET /v1/mandate/agreements/{id}`: [Retrieve an agreement](#get-v1-mandate-agreements-id)
- `GET /v1/mandate/agreements/{id}/receipt`: [Get an agreement receipt](#get-v1-mandate-agreements-id-receipt)
- `GET /v1/mandate/agreements`: [List agreements](#get-v1-mandate-agreements)

## The agreement object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Unique identifier for the object. |
| `object` | enum | yes | The type of object. One of `agreement`. |
| `content_hash` | string | no | SHA-256 of the document. |
| `content_description` | string | no | A description of the document. |
| `mode` | string | no | The mode in effect. |
| `status` | string | no | The object's current status. |
| `parties` | array of objects | no | The parties, in signing order. |
| `parties.party_id` | string | yes | The party's ID. |
| `parties.label` | string | yes | A short human-readable label. |
| `parties.status` | string | yes | The object's current status. |
| `parties.signed_at` | any \| null | yes | When the party signed. |
| `parties.tier` | any \| null | yes | The verified tier. |
| `expires_at` | string | no | When it expires. |
| `created_at` | string | no | When it was created. |
| `completed_at` | any \| null | no | When every party had signed. |
| `signing_links` | array of objects | no | Each party's signing link. Returned once, at creation. |
| `signing_links.party_id` | string | yes | The party's ID. |
| `signing_links.label` | string | yes | A short human-readable label. |
| `signing_links.url` | string | yes | A URL. |
| `overall_status` | string | no | The overall status, the worst of its parts. |
| `party` | object | no | The party. |
| `party.party_id` | string | yes | The party's ID. |
| `party.label` | string | yes | A short human-readable label. |
| `party.status` | string | yes | The object's current status. |
| `other_parties` | array of objects | no | The other parties, by label and status. |
| `other_parties.label` | string | yes | A short human-readable label. |
| `other_parties.status` | string | yes | The object's current status. |
| `sign_challenge` | string | no | The challenge this party signs with their passkey. |
| `can_sign` | boolean | no | Whether this party can sign now. |
| `party_status` | string | no | This party's status. |
| `waiting_for_other` | boolean | no | Whether this party is waiting for the other to sign first. |
| `consent` | object | no | The consent text the approver accepts. |
| `consent.draft` | boolean | yes | Whether the consent text is a draft. |
| `consent.version` | string | yes | The version number. |
| `consent.marker` | string | yes | The DRAFT marker shown with the consent text. |
| `disclaimer` | string | no | What the agreement proves and what it doesn't. |
| `receipt_url` | string | no | A link to the completion receipt. |

### Example

```json
{
  "id": "agr_01M6VQBCKJRJDMXHNTHJM1YWY7",
  "object": "agreement",
  "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
  "content_description": "Services agreement v3",
  "mode": "parallel",
  "status": "pending",
  "parties": [
    {
      "party_id": "pty_01M6VQBCKJPFR7PFY8MF628ERM",
      "label": "Provider",
      "status": "pending",
      "signed_at": null,
      "tier": null
    },
    {
      "party_id": "pty_01M6VQBCKJZ08BW431ZMT1X0JE",
      "label": "Client",
      "status": "pending",
      "signed_at": null,
      "tier": null
    }
  ],
  "expires_at": "2026-11-14T19:21:46.354Z",
  "created_at": "2026-11-07T19:21:46.354Z",
  "completed_at": null,
  "signing_links": [
    {
      "party_id": "pty_01M6VQBCKJPFR7PFY8MF628ERM",
      "label": "Provider",
      "url": "http://localhost:5173/sign/YWdyXzAxTTZWUUJDS0pSSkRNWEhOVEhKTTFZV1k3fnB0eV8wMU02VlFCQ0tKUEZSN1BGWThNRjYyOEVSTX4xNzk0Njg0MTA2.nr3vFNYbvFWS4Ff9dN730J5EIYvh-DwxMAQNpFYbFAM"
    },
    {
      "party_id": "pty_01M6VQBCKJZ08BW431ZMT1X0JE",
      "label": "Client",
      "url": "http://localhost:5173/sign/YWdyXzAxTTZWUUJDS0pSSkRNWEhOVEhKTTFZV1k3fnB0eV8wMU02VlFCQ0tKWjA4Qlc0MzFaTVQxWDBKRX4xNzk0Njg0MTA2.yhYnf4yUKyeTxXsv4wZIwfi1w3mNkIzRfbIgPSuwf3E"
    }
  ]
}
```

## Events

Sent to your [webhook endpoints](https://provenanceauth.com/docs/integrate/webhooks.md) when they subscribe:

- `mandate.agreement.completed`
- `mandate.agreement.declined`

## Create an agreement

`POST /v1/mandate/agreements`

Creates an agreement over a document's SHA-256 hash, with a signing link per party. Each party confirms with a passkey over the hash and their role. The document itself is never sent.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `content_hash` | body | string | yes | sha-256 hex of the canonicalized document. |
| `content_description` | body | string | yes | A description of the document. |
| `parties` | body | array of objects | yes | The parties, in signing order. |
| `parties.label` | body | string | yes | A short human-readable label. |
| `parties.email` | body | string | no | An email address. |
| `parties.phone` | body | string | no | The party's phone number, to send the link by SMS. |
| `mode` | body | enum | no | The mode in effect. One of `parallel`, `sequential`. |
| `expires_in_hours` | body | integer | no | How long the agreement stays open, in hours. |

### Returns

The agreement, with a signing link for each party. See [the agreement object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`usage_limit_reached`](https://provenanceauth.com/docs/platform/errors.md#usage_limit_reached)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/mandate/agreements" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
    "content_description": "Services agreement v3",
    "mode": "parallel",
    "parties": [
      {
        "label": "Provider",
        "email": "ops@brindlecote.example"
      },
      {
        "label": "Client",
        "email": "legal@acme.example"
      }
    ]
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agreements`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
    "content_description": "Services agreement v3",
    "mode": "parallel",
    "parties": [
      {
        "label": "Provider",
        "email": "ops@brindlecote.example"
      },
      {
        "label": "Client",
        "email": "legal@acme.example"
      }
    ]
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/agreements", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
    "content_description": "Services agreement v3",
    "mode": "parallel",
    "parties": [
        {
            "label": "Provider",
            "email": "ops@brindlecote.example"
        },
        {
            "label": "Client",
            "email": "legal@acme.example"
        }
    ]
}).json()
```

### Response 201

```json
{
  "id": "agr_01M6VQBCKJRJDMXHNTHJM1YWY7",
  "object": "agreement",
  "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
  "content_description": "Services agreement v3",
  "mode": "parallel",
  "status": "pending",
  "parties": [
    {
      "party_id": "pty_01M6VQBCKJPFR7PFY8MF628ERM",
      "label": "Provider",
      "status": "pending",
      "signed_at": null,
      "tier": null
    },
    {
      "party_id": "pty_01M6VQBCKJZ08BW431ZMT1X0JE",
      "label": "Client",
      "status": "pending",
      "signed_at": null,
      "tier": null
    }
  ],
  "expires_at": "2026-11-14T19:21:46.354Z",
  "created_at": "2026-11-07T19:21:46.354Z",
  "completed_at": null,
  "signing_links": [
    {
      "party_id": "pty_01M6VQBCKJPFR7PFY8MF628ERM",
      "label": "Provider",
      "url": "http://localhost:5173/sign/YWdyXzAxTTZWUUJDS0pSSkRNWEhOVEhKTTFZV1k3fnB0eV8wMU02VlFCQ0tKUEZSN1BGWThNRjYyOEVSTX4xNzk0Njg0MTA2.nr3vFNYbvFWS4Ff9dN730J5EIYvh-DwxMAQNpFYbFAM"
    },
    {
      "party_id": "pty_01M6VQBCKJZ08BW431ZMT1X0JE",
      "label": "Client",
      "url": "http://localhost:5173/sign/YWdyXzAxTTZWUUJDS0pSSkRNWEhOVEhKTTFZV1k3fnB0eV8wMU02VlFCQ0tKWjA4Qlc0MzFaTVQxWDBKRX4xNzk0Njg0MTA2.yhYnf4yUKyeTxXsv4wZIwfi1w3mNkIzRfbIgPSuwf3E"
    }
  ]
}
```

## Retrieve an agreement

`GET /v1/mandate/agreements/{id}`

Returns an agreement with each party's status.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

The agreement, with each party's status. See [the agreement object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/agreements" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
    "content_description": "Services agreement v3",
    "mode": "parallel",
    "parties": [
      {
        "label": "Provider",
        "email": "ops@brindlecote.example"
      },
      {
        "label": "Client",
        "email": "legal@acme.example"
      }
    ]
  }' > step.json
export AGREEMENT_ID=$(jq -r '.id' step.json)
export SIGN_URL=$(jq -r '.signing_links[0].url' step.json)
curl "$PROVENANCE_API/v1/mandate/agreements/$AGREEMENT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agreements`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
    "content_description": "Services agreement v3",
    "mode": "parallel",
    "parties": [
      {
        "label": "Provider",
        "email": "ops@brindlecote.example"
      },
      {
        "label": "Client",
        "email": "legal@acme.example"
      }
    ]
  }),
})).json();
const agreementId = step1.id;
const signUrl = step1.signing_links[0].url;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agreements/${agreementId}`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/agreements", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
    "content_description": "Services agreement v3",
    "mode": "parallel",
    "parties": [
        {
            "label": "Provider",
            "email": "ops@brindlecote.example"
        },
        {
            "label": "Client",
            "email": "legal@acme.example"
        }
    ]
}).json()
agreement_id = step1["id"]
sign_url = step1["signing_links"][0]["url"]
data = httpx.get(f"{api}/v1/mandate/agreements/{agreement_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "agr_01M6VQBCKK1A11DP42VAM0P5WS",
  "object": "agreement",
  "content_hash": "f7fc850029ac065767a610de3fb0f55a1b27b15cf4e5316c20af995a91574505",
  "content_description": "Services agreement v3",
  "mode": "parallel",
  "status": "pending",
  "parties": [
    {
      "party_id": "pty_01M6VQBCKKH2ZGTQA40MD5JMKJ",
      "label": "Provider",
      "status": "pending",
      "signed_at": null,
      "tier": null
    },
    {
      "party_id": "pty_01M6VQBCKKD2W3HHXKG7EBQDSG",
      "label": "Client",
      "status": "pending",
      "signed_at": null,
      "tier": null
    }
  ],
  "expires_at": "2026-11-14T19:21:46.355Z",
  "created_at": "2026-11-07T19:21:46.355Z",
  "completed_at": null
}
```

## Get an agreement receipt

`GET /v1/mandate/agreements/{id}/receipt`

Returns the completion receipt, an ES256 JWS over the agreement and each party's signing evidence, once every party has signed.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

The receipt, its signed token and a link to verify it.

### Errors

- [`agreement_invalid`](https://provenanceauth.com/docs/platform/errors.md#agreement_invalid)
- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/agreements/agr_01M5Q2KJMKC7J3XJPD6BEYMFGB/receipt" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agreements/agr_01M5Q2KJMKC7J3XJPD6BEYMFGB/receipt`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/agreements/agr_01M5Q2KJMKC7J3XJPD6BEYMFGB/receipt", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "receipt",
  "id": "rcpt_a763dae0d5d6852156a1846ac45e5f21",
  "claims": {
    "receipt_id": "rcpt_a763dae0d5d6852156a1846ac45e5f21",
    "type": "agreement_completion",
    "agreement_id": "agr_01M5Q2KJMKC7J3XJPD6BEYMFGB",
    "content_hash": "9f2c4e6a8b0d1f3e5a7c9b1d3f5e7a9c0b2d4f6e8a1c3b5d7f9e0a2c4b6d8f1e",
    "content_description": "Master services agreement v3, Brindlecote and Fallowmere",
    "mode": "parallel",
    "status": "completed",
    "completed_at": "2026-10-24T22:52:10.410Z",
    "parties": [
      {
        "party_id": "pty_01M5Q2KJMKVY6QJKSJXEA6T7VB",
        "label": "Brindlecote (buyer)",
        "status": "signed",
        "signed_at": "2026-10-24T22:40:12.004Z",
        "tier": "sep"
      },
      {
        "party_id": "pty_01M5Q2KJMKXR3W9D2T8N6F4C1A",
        "label": "Fallowmere (supplier)",
        "status": "signed",
        "signed_at": "2026-10-24T22:52:10.410Z",
        "tier": "strongbox"
      }
    ],
    "iss": "https://provenanceauth.com"
  },
  "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtcmVjZWlwdCtqd3QifQ.eyJyZWNlaXB0X2lkIjoi…",
  "verify_url": "https://app.provenanceauth.com/developers/verify?receipt=eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtcmVjZWlwdCtqd3QifQ.eyJyZWNlaXB0X2lkIjoi…"
}
```

## List agreements

`GET /v1/mandate/agreements`

Lists your account's two-sided agreements.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The account's agreements.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/agreements" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agreements`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/agreements", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}
```
