---
title: Change an access grant
description: "Change a live access grant's label, purpose, evidence, expiry or scope. The role cannot change. Reviving an expired grant respects the 50-active cap."
canonical: "https://www.tracepass.eu/docs/update-access-grant"
locale: en
source: "https://www.tracepass.eu/docs/update-access-grant"
---

# Change an access grant

> Change a live access grant's label, purpose, evidence, expiry or scope. The role cannot change. Reviving an expired grant respects the 50-active cap.

```http
PATCH /api/v1/access-grants/{id}
```

Change a live grant's label, purpose, evidence, expiry or scope. Send only the keys you want to change, and at least one. The role cannot be changed: revoke the grant and create a new one. An authority grant (an authority role or the authority tier) can only be changed in the dashboard: through the API it answers `400 role_dashboard_only`.

Moving an expired grant's expiry forward makes it active again, and the cap of 50 active grants applies as it does on creation. A revoked grant answers `404`. The change is written to the grant's access log with the API key or app that made it.

**Who may call it.** An API key only when its owner switched on "May manage access grants" for that key on the Developer page (off by default; otherwise `403 access_grants_not_enabled`). An OAuth token needs the `access_grants:write` scope and a user who is an admin or owner. Needs a paying account. Counts as one v1 write. Honours `Idempotency-Key`.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Authorization` | header | string | yes | `Bearer <token>` — either a `tp_` API key (Developer → API Keys; simplest, for server-to-server) or an OAuth 2.0 access token (Developer → OAuth Apps; for user-authorized apps, scoped + revocable). The Authentication page has the full OAuth flow and scope list. |
| `Idempotency-Key` | header | string | no | UUID v4. |
| `id` | path | string (24 hex chars) | yes | Access grant ID. |
| `label` | body | string (1-120 chars) | no | New label. |
| `purpose` | body | string (max 500 chars) | no | New purpose. |
| `scope` | body | object | no | New scope, same shape as on creation. A purchaser grant must stay on passports. |
| `evidence` | body | object | no | New evidence `{ type, reference, note? }`. |
| `expiresInDays` | body | integer \| null (1-1825) | no | Days from now until expiry; `null` = no expiry. |

## Examples

```bash
curl -sS -X PATCH https://app.tracepass.eu/api/v1/access-grants/6650c1d2e3f4a5b6c7d8e9f0 \
  -H "Authorization: Bearer tp_REDACTED_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "expiresInDays": 90 }'
```

```typescript
const res = await fetch(`https://app.tracepass.eu/api/v1/access-grants/${grantId}`, {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.TRACEPASS_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ expiresInDays: 90 }),
});
```

```python
import os, requests
res = requests.patch(
    f"https://app.tracepass.eu/api/v1/access-grants/{grant_id}",
    headers={"Authorization": f"Bearer {os.environ['TRACEPASS_API_KEY']}"},
    json={"expiresInDays": 90},
)
res.raise_for_status()
```

## Responses

### 200 — Changed

```json
{
  "data": {
    "id": "6650c1d2e3f4a5b6c7d8e9f0",
    "accessLevel": "restricted",
    "label": "Buyer GmbH, order 4711",
    "role": "purchaser",
    "scope": { "kind": "passports", "ids": ["6650a1b2c3d4e5f6a7b8c9d0"] },
    "purpose": null,
    "evidence": null,
    "state": "active",
    "expiresAt": null,
    "useCount": 0,
    "createdAt": "2026-06-01T09:30:00.000Z"
  }
}
```

### 400 — Nothing to change

```json
{
  "error": "Validation error",
  "details": [": nothing to change"]
}
```

### 403 — Switch off

```json
{
  "error": "access_grants_not_enabled",
  "message": "This API key may not manage access grants. Its owner can switch on 'May manage access grants' for the key on the Developer page."
}
```

### 404 — Not found

```json
{ "error": "Access grant not found" }
```

## Related

- [Read an access grant](https://www.tracepass.eu/docs/get-access-grant.md)
- [Revoke an access grant](https://www.tracepass.eu/docs/revoke-access-grant.md)
