# Usage tags API

## GET /api/v1/admin/usage-tags

`GET /api/v1/admin/usage-tags` · operation `getUsageTagPolicy`

Global administrator only. Reads the finite allowed tag taxonomy with its consistent global configuration version and current YAML fingerprint. Requires usage_tags; no-store. Tag values are declarations or authenticated-team defaults, not authorization or financial evidence.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Current policy snapshot | `application/json`: [UsageTagPolicySnapshot](/docs/api/schemas/u/#usagetagpolicysnapshot) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |


## PUT /api/v1/admin/usage-tags

`PUT /api/v1/admin/usage-tags` · operation `replaceUsageTagPolicy`

Replace the complete taxonomy. Global admin, usage_tag_management, same origin and CSRF required. Whole snapshot validation precedes versioned PostgreSQL commit. Policy max16KiB; request max32KiB, unique JSON keys and strings-only enum values. No retroactive relabeling.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `expected_base_fingerprint` (string, required)
  - `policy` ([UsageTagPolicy](/docs/api/schemas/u/#usagetagpolicy), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Latest consistent policy snapshot after commit | `application/json`: [UsageTagPolicySnapshot](/docs/api/schemas/u/#usagetagpolicysnapshot) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `409` | Global configuration version or current YAML base changed | — |
| `422` | Invalid taxonomy or snapshot dependency | — |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |


## DELETE /api/v1/admin/usage-tags

`DELETE /api/v1/admin/usage-tags` · operation `revertUsageTagPolicy`

Revert the policy override to current YAML. Does not remove historical tags. Global admin, usage_tag_management, same origin and CSRF required.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `expected_base_fingerprint` (string, required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Latest consistent policy snapshot after commit | `application/json`: [UsageTagPolicySnapshot](/docs/api/schemas/u/#usagetagpolicysnapshot) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `409` | Global configuration version or current YAML base changed | — |
| `503` | Local concurrency limit reached | `application/json`: [Error](/docs/api/schemas/e/#error) |

