# Stack API Reference

Source: https://docs.formance.com/v4.0/stack-api-reference

Stack: v4.0

The Formance Platform exposes a unified REST API across all modules. All endpoints use JSON for request and response bodies, and authentication is handled via OAuth2 bearer tokens.

```bash
export FORMANCE_API_URL="https://<your-stack>.sandbox.formance.cloud"
export FORMANCE_TOKEN=$(fctl cloud generate-personal-token)
```

Stack v4 API preview

This reference previews the Stack v4 API. Stack v4.0.0-beta.1 is available as a prerelease; it does not mark the stable release of Stack v4.

It intentionally includes only:

- **Ledger v3** operations tagged `ledger.v3`;
- **Auth** operations tagged `auth.v1`;
- **Connectivity** operations tagged `connectivity.v1`;
- **Other** shared or currently untagged operations, including Stack version discovery.

The candidate still contains other module contracts, but they are deliberately excluded from this v4 reference.

Download the [OpenAPI specification for Stack v4.0.0-beta.1 (JSON)](https://github.com/formancehq/stack/releases/download/v4.0.0-beta.1/generate.json). This file includes all module contracts, including those excluded from this reference.

<a id="auth-getOIDCWellKnowns"></a>

### GET /api/auth/.well-known/openid-configuration

Get OpenID Configuration

Retrieve the OpenID Connect discovery document containing authorization server metadata.

This endpoint returns configuration information including:

- Token endpoint URLs
- Supported scopes and grant types
- Signing algorithms
- JWKS URI for token verification

See the [OpenID Connect Discovery spec](https://openid.net/specs/openid-connect-discovery-1_0.html) for more details.

```json
{
  "method": "GET",
  "path": "/api/auth/.well-known/openid-configuration",
  "summary": "Get OpenID Configuration",
  "description": "Retrieve the OpenID Connect discovery document containing authorization server metadata.\n\nThis endpoint returns configuration information including:\n- Token endpoint URLs\n- Supported scopes and grant types\n- Signing algorithms\n- JWKS URI for token verification\n\nSee the [OpenID Connect Discovery spec](https://openid.net/specs/openid-connect-discovery-1_0.html) for more details.\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "responses": [
    {
      "code": "200",
      "description": "OpenID provider configuration"
    }
  ]
}
```

<a id="auth-listClients"></a>

### GET /api/auth/clients

List Clients

List all OAuth2/OIDC clients registered in the system.

**What is a Client?**
A client is an application that can request tokens to access Formance APIs. Each client has credentials (ID and secrets) used for authentication.

**Client Types:**

- **Confidential**: Server-side apps that can securely store secrets
- **Public**: Mobile/SPA apps that cannot store secrets securely

```json
{
  "method": "GET",
  "path": "/api/auth/clients",
  "summary": "List Clients",
  "description": "List all OAuth2/OIDC clients registered in the system.\n\n**What is a Client?**\nA client is an application that can request tokens to access Formance APIs. Each client has credentials (ID and secrets) used for authentication.\n\n**Client Types:**\n- **Confidential**: Server-side apps that can securely store secrets\n- **Public**: Mobile/SPA apps that cannot store secrets securely\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Clients",
  "responses": [
    {
      "code": "200",
      "description": "List of clients",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "auth_ListClientsResponse",
        "properties": [
          {
            "name": "data",
            "type": "array of auth_Client",
            "description": "The clients registered on this stack"
          }
        ]
      }
    }
  ]
}
```

<a id="auth-createClient"></a>

### POST /api/auth/clients

Create Client

Create a new OAuth2/OIDC client.

**Example: Create a Server-Side Application Client**

```json
{
  "name": "My Backend Service",
  "public": false,
  "description": "Backend service for processing payments",
  "redirectUris": ["https://myapp.com/callback"],
  "postLogoutRedirectUris": ["https://myapp.com/logout"],
  "scopes": ["ledger:read", "ledger:write", "payments:read"]
}
```

After creation, you'll need to create a secret for the client using the Create Secret endpoint.

````json
{
  "method": "POST",
  "path": "/api/auth/clients",
  "summary": "Create Client",
  "description": "Create a new OAuth2/OIDC client.\n\n**Example: Create a Server-Side Application Client**\n```json\n{\n  \"name\": \"My Backend Service\",\n  \"public\": false,\n  \"description\": \"Backend service for processing payments\",\n  \"redirectUris\": [\"https://myapp.com/callback\"],\n  \"postLogoutRedirectUris\": [\"https://myapp.com/logout\"],\n  \"scopes\": [\"ledger:read\", \"ledger:write\", \"payments:read\"]\n}\n```\n\nAfter creation, you'll need to create a secret for the client using the Create Secret endpoint.\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Clients",
  "requestBody": {
    "mediaType": "application/json",
    "description": "The client configuration.\n",
    "schema": {
      "type": "object",
      "ref": "auth_CreateClientRequest",
      "properties": [
        {
          "name": "public",
          "type": "boolean",
          "description": "Whether the client is public, meaning it cannot keep a secret and uses PKCE instead"
        },
        {
          "name": "redirectUris",
          "type": "array of string",
          "description": "URIs the authorization server may redirect to after a successful authorization"
        },
        {
          "name": "description",
          "type": "string",
          "description": "Human-readable description of the client"
        },
        {
          "name": "name",
          "type": "string",
          "description": "Display name of the client",
          "required": true
        },
        {
          "name": "trusted",
          "type": "boolean",
          "description": "Whether the client is trusted, skipping the user consent screen"
        },
        {
          "name": "postLogoutRedirectUris",
          "type": "array of string",
          "description": "URIs the authorization server may redirect to after logout"
        },
        {
          "name": "metadata",
          "type": "auth_Metadata"
        },
        {
          "name": "scopes",
          "type": "array of string",
          "description": "Scopes the client is allowed to request"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Client created successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "auth_CreateClientResponse",
        "properties": [
          {
            "name": "data",
            "type": "auth_Client"
          }
        ]
      }
    }
  ]
}
````

<a id="auth-readClient"></a>

### GET /api/auth/clients/{clientId}

Read Client

Retrieve details of a specific OAuth2 client.

**Response includes:**

- Client ID and name
- Public/confidential status
- Redirect URIs
- Authorized scopes
- Associated secrets (IDs only, not values)

```json
{
  "method": "GET",
  "path": "/api/auth/clients/{clientId}",
  "summary": "Read Client",
  "description": "Retrieve details of a specific OAuth2 client.\n\n**Response includes:**\n- Client ID and name\n- Public/confidential status\n- Redirect URIs\n- Authorized scopes\n- Associated secrets (IDs only, not values)\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Clients",
  "pathParams": [
    {
      "name": "clientId",
      "description": "Client ID"
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Client details",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "auth_ReadClientResponse",
        "properties": [
          {
            "name": "data",
            "type": "auth_Client"
          }
        ]
      }
    }
  ]
}
```

<a id="auth-updateClient"></a>

### PUT /api/auth/clients/{clientId}

Update Client

Update an OAuth2 client's configuration.

You can update:

- Name and description
- Public/confidential status
- Redirect URIs
- Post-logout redirect URIs
- Authorized scopes

```json
{
  "method": "PUT",
  "path": "/api/auth/clients/{clientId}",
  "summary": "Update Client",
  "description": "Update an OAuth2 client's configuration.\n\nYou can update:\n- Name and description\n- Public/confidential status\n- Redirect URIs\n- Post-logout redirect URIs\n- Authorized scopes\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Clients",
  "pathParams": [
    {
      "name": "clientId",
      "description": "Client ID"
    }
  ],
  "requestBody": {
    "mediaType": "application/json",
    "description": "The updated client configuration.\n",
    "schema": {
      "type": "object",
      "ref": "auth_UpdateClientRequest",
      "properties": [
        {
          "name": "public",
          "type": "boolean",
          "description": "Whether the client is public, meaning it cannot keep a secret and uses PKCE instead"
        },
        {
          "name": "redirectUris",
          "type": "array of string",
          "description": "URIs the authorization server may redirect to after a successful authorization"
        },
        {
          "name": "description",
          "type": "string",
          "description": "Human-readable description of the client"
        },
        {
          "name": "name",
          "type": "string",
          "description": "Display name of the client",
          "required": true
        },
        {
          "name": "trusted",
          "type": "boolean",
          "description": "Whether the client is trusted, skipping the user consent screen"
        },
        {
          "name": "postLogoutRedirectUris",
          "type": "array of string",
          "description": "URIs the authorization server may redirect to after logout"
        },
        {
          "name": "metadata",
          "type": "auth_Metadata"
        },
        {
          "name": "scopes",
          "type": "array of string",
          "description": "Scopes the client is allowed to request"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "200",
      "description": "Client updated successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "auth_UpdateClientResponse",
        "properties": [
          {
            "name": "data",
            "type": "auth_Client"
          }
        ]
      }
    }
  ]
}
```

<a id="auth-deleteClient"></a>

### DELETE /api/auth/clients/{clientId}

Delete Client

Delete an OAuth2 client.

**Warning:** This will:

- Revoke all existing tokens for this client
- Delete all associated secrets
- Prevent any future authentication attempts

This action cannot be undone.

```json
{
  "method": "DELETE",
  "path": "/api/auth/clients/{clientId}",
  "summary": "Delete Client",
  "description": "Delete an OAuth2 client.\n\n**Warning:** This will:\n- Revoke all existing tokens for this client\n- Delete all associated secrets\n- Prevent any future authentication attempts\n\nThis action cannot be undone.\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Clients",
  "pathParams": [
    {
      "name": "clientId",
      "description": "Client ID"
    }
  ],
  "responses": [
    {
      "code": "204",
      "description": "Client deleted successfully"
    }
  ]
}
```

<a id="auth-createSecret"></a>

### POST /api/auth/clients/{clientId}/secrets

Create Secret

Create a new secret for an OAuth2 client.

**Important:** The secret value is only returned once in the response. Store it securely as it cannot be retrieved later.

**Example:**

```json
{
  "name": "Production API Key",
  "metadata": {
    "environment": "production",
    "created_by": "admin"
  }
}
```

A client can have multiple secrets for rotation purposes.

````json
{
  "method": "POST",
  "path": "/api/auth/clients/{clientId}/secrets",
  "summary": "Create Secret",
  "description": "Create a new secret for an OAuth2 client.\n\n**Important:** The secret value is only returned once in the response. Store it securely as it cannot be retrieved later.\n\n**Example:**\n```json\n{\n  \"name\": \"Production API Key\",\n  \"metadata\": {\n    \"environment\": \"production\",\n    \"created_by\": \"admin\"\n  }\n}\n```\n\nA client can have multiple secrets for rotation purposes.\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Clients",
  "pathParams": [
    {
      "name": "clientId",
      "description": "Client ID"
    }
  ],
  "requestBody": {
    "mediaType": "application/json",
    "description": "The secret configuration.\n",
    "schema": {
      "type": "object",
      "ref": "auth_CreateSecretRequest",
      "properties": [
        {
          "name": "name",
          "type": "string",
          "description": "Human-readable name identifying the secret",
          "required": true
        },
        {
          "name": "metadata",
          "type": "auth_Metadata"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "200",
      "description": "Secret created successfully. **Save the `clear` value immediately - it cannot be retrieved again.**\n",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "auth_CreateSecretResponse",
        "properties": [
          {
            "name": "data",
            "type": "auth_Secret"
          }
        ]
      }
    }
  ]
}
````

<a id="auth-deleteSecret"></a>

### DELETE /api/auth/clients/{clientId}/secrets/{secretId}

Delete Secret

Delete a client secret.

**Use Cases:**

- Rotating credentials (create new secret, update apps, delete old secret)
- Revoking compromised credentials
- Cleaning up unused secrets

After deletion, any authentication attempts using this secret will fail.

```json
{
  "method": "DELETE",
  "path": "/api/auth/clients/{clientId}/secrets/{secretId}",
  "summary": "Delete Secret",
  "description": "Delete a client secret.\n\n**Use Cases:**\n- Rotating credentials (create new secret, update apps, delete old secret)\n- Revoking compromised credentials\n- Cleaning up unused secrets\n\nAfter deletion, any authentication attempts using this secret will fail.\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Clients",
  "pathParams": [
    {
      "name": "clientId",
      "description": "Client ID"
    },
    {
      "name": "secretId",
      "description": "Secret ID"
    }
  ],
  "responses": [
    {
      "code": "204",
      "description": "Secret deleted successfully"
    }
  ]
}
```

<a id="auth-listUsers"></a>

### GET /api/auth/users

List Users

List all users registered in the authentication system.

**Response includes for each user:**

- User ID
- Email address
- Subject identifier (from identity provider)

```json
{
  "method": "GET",
  "path": "/api/auth/users",
  "summary": "List Users",
  "description": "List all users registered in the authentication system.\n\n**Response includes for each user:**\n- User ID\n- Email address\n- Subject identifier (from identity provider)\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Users",
  "responses": [
    {
      "code": "200",
      "description": "List of users",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "auth_ListUsersResponse",
        "properties": [
          {
            "name": "data",
            "type": "array of auth_User",
            "description": "The users known to this stack"
          }
        ]
      }
    }
  ]
}
```

<a id="auth-readUser"></a>

### GET /api/auth/users/{userId}

Read User

Retrieve details of a specific user.

**Response includes:**

- User ID
- Email address
- Subject identifier
- Creation timestamp

```json
{
  "method": "GET",
  "path": "/api/auth/users/{userId}",
  "summary": "Read User",
  "description": "Retrieve details of a specific user.\n\n**Response includes:**\n- User ID\n- Email address\n- Subject identifier\n- Creation timestamp\n",
  "tags": [
    "auth.v1"
  ],
  "module": "Auth",
  "resourceGroup": "Users",
  "pathParams": [
    {
      "name": "userId",
      "description": "User ID"
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "User details",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "auth_ReadUserResponse",
        "properties": [
          {
            "name": "data",
            "type": "auth_User"
          }
        ]
      }
    }
  ]
}
```

<a id="other-getVersions"></a>

### GET /versions

Show stack version information

```json
{
  "method": "GET",
  "path": "/versions",
  "summary": "Show stack version information",
  "description": "",
  "tags": [],
  "module": "Other",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "gateway_GetVersionsResponse",
        "properties": [
          {
            "name": "region",
            "type": "string",
            "description": "Region the stack is deployed in",
            "required": true
          },
          {
            "name": "env",
            "type": "string",
            "description": "Environment the stack is deployed in",
            "required": true
          },
          {
            "name": "versions",
            "type": "array of gateway_Version",
            "description": "Version and health of each component in the stack",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listAllLedgers"></a>

### GET /api/ledger/v3/

List all ledgers

Lists the ledgers in the cluster, paged by name (ascending unless
`reverse=true`). Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/",
  "summary": "List all ledgers",
  "description": "Lists the ledgers in the cluster, paged by name (ascending unless\n`reverse=true`). Requires `ledger:read` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Ledgers",
  "queryParams": [
    {
      "name": "reverse",
      "description": "List in descending name order when true.",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "List of ledgers retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_ListAllLedgersResponse",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_LedgerInfo",
            "description": "One page of ledgers, in the requested name order",
            "required": true
          },
          {
            "name": "next",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "previous",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "hasMore",
            "type": "boolean",
            "description": "True when a following page exists; set iff `next` is.",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getLedger"></a>

### GET /api/ledger/v3/{ledgerName}

Get a ledger

Retrieves a ledger by its name. Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}",
  "summary": "Get a ledger",
  "description": "Retrieves a ledger by its name. Requires `ledger:read` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Ledgers",
  "responses": [
    {
      "code": "200",
      "description": "Ledger retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetLedgerResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_LedgerInfo",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-createLedger"></a>

### POST /api/ledger/v3/{ledgerName}

Create a new ledger

Creates a new ledger with the specified name. Storage is configured at the server level.
Each ledger has its own Raft group for data consistency. Requires `ledger:write` scope.

The ledger name `_` is reserved: all system / non-ledger routes live
under the `/v3/_/…` segment (e.g. `/v3/_/audit-entries`), so a ledger
named `_` would be unreachable over REST. Creating it is rejected with a
validation error. The exact name `_system` is also reserved for system
events and rejected. Other underscore-prefixed names remain valid.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}",
  "summary": "Create a new ledger",
  "description": "Creates a new ledger with the specified name. Storage is configured at the server level.\nEach ledger has its own Raft group for data consistency. Requires `ledger:write` scope.\n\nThe ledger name `_` is reserved: all system / non-ledger routes live\nunder the `/v3/_/…` segment (e.g. `/v3/_/audit-entries`), so a ledger\nnamed `_` would be unreachable over REST. Creating it is rejected with a\nvalidation error. The exact name `_system` is also reserved for system\nevents and rejected. Other underscore-prefixed names remain valid.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Ledgers",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_CreateLedgerRequest",
      "properties": [
        {
          "name": "metadata",
          "type": "object",
          "description": "Initial typed metadata, persisted atomically with creation in NORMAL and MIRROR modes. Creation requires ledger:WriteLedger, including initial metadata; later metadata saves require ledger:WriteMetadata. JSON null entries are omitted. Schema declarations govern indexing and queries, not write-time value coercion. Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy."
        },
        {
          "name": "mode",
          "type": "string",
          "description": "Ledger mode. MIRROR creates a read-only ledger that syncs from an external v2 source. Values are case-sensitive; any other value is rejected with 400 INVALID_REQUEST.",
          "enumValues": [
            "NORMAL",
            "MIRROR"
          ]
        },
        {
          "name": "mirrorSource",
          "type": "ledgerV3_MirrorSourceConfig"
        },
        {
          "name": "defaultEnforcementMode",
          "type": "string",
          "description": "Default chart-of-accounts enforcement for accounts that match no account type.",
          "enumValues": [
            "STRICT",
            "AUDIT"
          ]
        },
        {
          "name": "initialSchema",
          "type": "array of ledgerV3_MetadataFieldTypeCommand",
          "description": "Metadata field type declarations to seed at creation time."
        },
        {
          "name": "accountTypes",
          "type": "object",
          "description": "Initial account types (name -> account type definition).",
          "example": {
            "user-checking": {
              "name": "user-checking",
              "pattern": "users:{id}:checking",
              "persistence": "EPHEMERAL",
              "segmentTypes": {
                "id": {
                  "type": "uuid"
                }
              }
            }
          }
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Ledger created successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_CreateLedgerResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_LedgerInfo",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-deleteLedger"></a>

### DELETE /api/ledger/v3/{ledgerName}

Delete a ledger

Deletes a ledger by its name. This operation removes the ledger and its associated Raft group from the cluster. Requires `ledger:write` scope.

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}",
  "summary": "Delete a ledger",
  "description": "Deletes a ledger by its name. This operation removes the ledger and its associated Raft group from the cluster. Requires `ledger:write` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Ledgers",
  "responses": [
    {
      "code": "204",
      "description": "Ledger deleted successfully"
    }
  ]
}
```

<a id="ledger-getLedgerStats"></a>

### GET /api/ledger/v3/{ledgerName}/stats

Get ledger statistics

Returns aggregate usage statistics (transaction, volume, reference, posting, log, revert and Numscript-execution counts, plus ephemeral-evicted and transient-used volume tallies) for a ledger. Requires `ledger:read` scope. On live reads, `transactionCount` and `logCount` are FSM-backed. The seven usage-derived counters (`postingCount`, `revertCount`, `numscriptExecutionCount`, `referenceCount`, `ephemeralEvictedCount`, `transientUsedCount`, `volumeCount`) are materialised asynchronously in the serving replica's usagestore and may lag committed state even after the request's ReadIndex barrier. Note: for checkpoint-scoped (historical) reads, only `transactionCount` and `logCount` are checkpoint-consistent; the usage-derived counters (`postingCount`, `revertCount`, `numscriptExecutionCount`, `referenceCount`, `ephemeralEvictedCount`, `transientUsedCount`, `volumeCount`) are sourced from the live usagestore projection, which is not checkpoint-aware, and are returned as `0` at a checkpoint rather than a live value — treat `0` on a checkpoint read as "not available at this checkpoint".

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/stats",
  "summary": "Get ledger statistics",
  "description": "Returns aggregate usage statistics (transaction, volume, reference, posting, log, revert and Numscript-execution counts, plus ephemeral-evicted and transient-used volume tallies) for a ledger. Requires `ledger:read` scope. On live reads, `transactionCount` and `logCount` are FSM-backed. The seven usage-derived counters (`postingCount`, `revertCount`, `numscriptExecutionCount`, `referenceCount`, `ephemeralEvictedCount`, `transientUsedCount`, `volumeCount`) are materialised asynchronously in the serving replica's usagestore and may lag committed state even after the request's ReadIndex barrier. Note: for checkpoint-scoped (historical) reads, only `transactionCount` and `logCount` are checkpoint-consistent; the usage-derived counters (`postingCount`, `revertCount`, `numscriptExecutionCount`, `referenceCount`, `ephemeralEvictedCount`, `transientUsedCount`, `volumeCount`) are sourced from the live usagestore projection, which is not checkpoint-aware, and are returned as `0` at a checkpoint rather than a live value — treat `0` on a checkpoint read as \"not available at this checkpoint\".",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Stats",
  "responses": [
    {
      "code": "200",
      "description": "Ledger statistics retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetLedgerStatsResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_LedgerStats",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listLedgerLogs"></a>

### GET /api/ledger/v3/{ledgerName}/logs

List logs for a ledger

Lists log entries for a specific ledger, paged by ledger-local log ID
(ascending unless `reverse=true`).
Requires the builtin `LOG` index to be enabled on the ledger via `CreateIndex`.
Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/logs",
  "summary": "List logs for a ledger",
  "description": "Lists log entries for a specific ledger, paged by ledger-local log ID\n(ascending unless `reverse=true`).\nRequires the builtin `LOG` index to be enabled on the ledger via `CreateIndex`.\nRequires `ledger:read` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Logs",
  "queryParams": [
    {
      "name": "reverse",
      "description": "List in descending ledger-local log ID order when true.",
      "required": false
    },
    {
      "name": "startDate",
      "description": "Filter logs with date >= startDate (inclusive, RFC3339 format).\nMust be on or after the Unix epoch (1970-01-01T00:00:00Z); earlier\ndates are rejected with a 400.\nRequires the builtin `LOG_DATE` index to be enabled on the ledger.\n",
      "required": false
    },
    {
      "name": "endDate",
      "description": "Filter logs with date < endDate (exclusive, RFC3339 format).\nMust be on or after the Unix epoch (1970-01-01T00:00:00Z); earlier\ndates are rejected with a 400.\nRequires the builtin `LOG_DATE` index to be enabled on the ledger.\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Logs retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_SystemLog",
            "required": true
          },
          {
            "name": "next",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "previous",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "hasMore",
            "type": "boolean",
            "description": "True when a following page exists; set iff `next` is.",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listAuditEntries"></a>

### GET /api/ledger/v3/\_/audit-entries

List audit entries

Lists audit trail entries (one per proposal, success or failure) across
the whole bucket, paged by audit sequence (ascending unless
`reverse=true`). Audit reads are
not ledger-scoped in the path — a single proposal can touch several
ledgers — so ledger scope, outcome and other dimensions are expressed
through the `filter` query parameter.

This endpoint always performs a live read and does not expose pinned
checkpoint reads. Filters containing indexed audit conditions wait for
the audit projection to certify the request's fixed main-store horizon;
matching entries are loaded from that same main snapshot. Unfiltered
reads and sequence-only bounds scan the audit zone directly without
waiting for the audit projection.

Requires `ledger:ReadAudit` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/audit-entries",
  "summary": "List audit entries",
  "description": "Lists audit trail entries (one per proposal, success or failure) across\nthe whole bucket, paged by audit sequence (ascending unless\n`reverse=true`). Audit reads are\nnot ledger-scoped in the path — a single proposal can touch several\nledgers — so ledger scope, outcome and other dimensions are expressed\nthrough the `filter` query parameter.\n\nThis endpoint always performs a live read and does not expose pinned\ncheckpoint reads. Filters containing indexed audit conditions wait for\nthe audit projection to certify the request's fixed main-store horizon;\nmatching entries are loaded from that same main snapshot. Unfiltered\nreads and sequence-only bounds scan the audit zone directly without\nwaiting for the audit projection.\n\nRequires `ledger:ReadAudit` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Audit Entries",
  "queryParams": [
    {
      "name": "reverse",
      "description": "Iterate newest-first (descending sequence) when true",
      "required": false
    },
    {
      "name": "filter",
      "description": "A filter, decoded by the same shared dual-format decoder every list\nendpoint uses (see the `ListFilter` parameter). In practice audit\nfilters use the **textual** representation, restricted to bare\naudit fields (`outcome`, `ledger`, `seq`, `proposal_id`,\n`timestamp`, `log_seq`, `caller_subject`, `order_type`,\n`idempotency_key`). These are\nwritten without any prefix and are resolved against the audit query\ntarget (EN-1549 — this replaced the old `audit[...]` namespaced\nsyntax; it is a breaking change with no backward compatibility):\n  - `outcome == failure`\n  - `ledger == main`\n  - `order_type in (create_transaction, revert_transaction)`\n  - `seq between 1000 and 2000`\n  - `timestamp >= \"2023-11-14T22:13:20Z\"`\n  - `idempotency_key == \"retry-123\"`\n  - `idempotency_key ^= \"import-2026-\"`\nSupported fields: `seq`, `proposal_id`, `log_seq` (numeric);\n`timestamp` (RFC3339 or unix microseconds); `outcome`\n(success|failure), `ledger`, `caller_subject`, `order_type`,\n`idempotency_key` (string; `idempotency_key` also supports prefix\nmatching with `^=`; a reused key returns every historical audit\nentry; bare alphanumeric values are accepted unquoted, while values\ncontaining `-`, `:`, spaces, or other non-identifier characters\nmust be single- or double-quoted; keys containing both `\"` and `'`\ncannot be expressed in the textual DSL and require the gRPC API\ndirectly: use `AuditCondition.string_cond` (one value per leaf) for\nexact lookups, an `OrFilter` of such leaves for `in` lookups, and\n`AuditCondition.string_prefix` for prefix lookups). Bare audit fields are resolved against the audit query\ntarget: `timestamp` and `ledger` collide with the transaction\n`timestamp` field and the top-level `ledger` condition, so on the\naudit target they resolve to the audit condition (and only there —\nhence audit fields are valid on this endpoint only). Audit\nconditions have NO structured JSON QueryFilter representation, so\nthe textual form is the canonical one here; a JSON QueryFilter\ncannot carry an audit condition and is rejected.\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "List of audit entries",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_AuditEntry",
            "required": true
          },
          {
            "name": "next",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "previous",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "hasMore",
            "type": "boolean",
            "description": "True when a following page exists; set iff `next` is.",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getAuditEntry"></a>

### GET /api/ledger/v3/\_/audit-entries/{sequence}

Get an audit entry

Returns a single audit entry by its global sequence, with per-order
`items` populated (the list endpoint omits `items` for compactness).
Requires `ledger:ReadAudit` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/audit-entries/{sequence}",
  "summary": "Get an audit entry",
  "description": "Returns a single audit entry by its global sequence, with per-order\n`items` populated (the list endpoint omits `items` for compactness).\nRequires `ledger:ReadAudit` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Audit Entries",
  "pathParams": [
    {
      "name": "sequence",
      "description": "Audit entry sequence"
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "The audit entry",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_AuditEntry"
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-promoteLedger"></a>

### POST /api/ledger/v3/{ledgerName}/promote

Promote a mirror ledger

Promotes a mirror-mode ledger to normal mode. After promotion, the mirror sync
worker is stopped and the ledger accepts direct write operations. Requires `ledger:write` scope.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/promote",
  "summary": "Promote a mirror ledger",
  "description": "Promotes a mirror-mode ledger to normal mode. After promotion, the mirror sync\nworker is stopped and the ledger accepts direct write operations. Requires `ledger:write` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Ledgers",
  "responses": [
    {
      "code": "201",
      "description": "Ledger promoted successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_PromoteLedgerResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_LedgerInfo",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-createTransaction_ledgerV3"></a>

### POST /api/ledger/v3/{ledgerName}/transactions

Create a new transaction

Creates a new transaction in the specified ledger with the specified postings. Requires `ledger:write` scope.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/transactions",
  "summary": "Create a new transaction",
  "description": "Creates a new transaction in the specified ledger with the specified postings. Requires `ledger:write` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Transactions",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_CreateTransactionRequest",
      "description": "A transaction must declare exactly one content source: explicit\n`postings`, an inline `script`, or a `scriptReference`. The\n`postings` array cannot be combined with `script` or\n`scriptReference`. Idempotency is controlled exclusively via the\n`Idempotency-Key` HTTP header — there is no body-level key.\n",
      "properties": [
        {
          "name": "accountMetadata",
          "type": "object",
          "description": "Metadata for accounts involved in the transaction (supports typed values). Account addresses must be nonempty and contain only letters, digits, colons, underscores and hyphens, without empty segments. Malformed addresses are rejected before submission; competing invalid addresses select the lexicographically smallest address. Each account's map is bounded independently. Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy."
        },
        {
          "name": "timestamp",
          "type": "string (date-time)",
          "description": "Transaction timestamp (ISO 8601 format). If not provided, current time is used."
        },
        {
          "name": "metadata",
          "type": "object",
          "description": "Transaction metadata (supports typed values). Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy."
        },
        {
          "name": "reference",
          "type": "string",
          "description": "Transaction reference"
        },
        {
          "name": "postings",
          "type": "array of ledgerV3_PostingRequest",
          "description": "List of postings for the transaction. Mutually exclusive with `script` and `scriptReference`."
        },
        {
          "name": "script",
          "type": "ledgerV3_Script",
          "description": "Inline Numscript to execute. Mutually exclusive with `postings` and `scriptReference`."
        },
        {
          "name": "scriptReference",
          "type": "ledgerV3_ScriptReference",
          "description": "Reference to a numscript saved in the ledger's library. Mutually exclusive with `postings` and `script`."
        },
        {
          "name": "force",
          "type": "boolean",
          "description": "Skip the balance check, so the transaction commits even when a source account has insufficient funds."
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Transaction created successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_CreateTransactionResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "transaction",
                  "type": "ledgerV3_TransactionResponse"
                },
                {
                  "name": "accountMetadata",
                  "type": "object",
                  "description": "Metadata for accounts involved in the transaction"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listLedgerTransactions"></a>

### GET /api/ledger/v3/{ledgerName}/transactions

List transactions for a ledger

Lists transactions for a specific ledger. The default order is
newest-first (descending transaction id); pass `reverse=true` to
get oldest-first (ascending). Supports cursor pagination (`pageSize`,
`cursor`), an optional date range (`startDate`/`endDate`),
and the generic `filter` parameter (e.g. reference selection via
`filter={"$match":{"reference":"..."}}`, URL-encoded). Requires
`ledger:ReadTransaction` scope.

This is a live read, linearizable by default. `X-Consistency: stale`
reads the receiving node's local state, which may lag the leader. Every
projection used by the filter is automatically aligned. Unlike the
gRPC API, it does not accept the `checkpointId` option to pin the read
to a specific historical snapshot — use gRPC for checkpoint-pinned
reads. (Tracked follow-up, same carve-out as the audit reads.)

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/transactions",
  "summary": "List transactions for a ledger",
  "description": "Lists transactions for a specific ledger. The default order is\nnewest-first (descending transaction id); pass `reverse=true` to\nget oldest-first (ascending). Supports cursor pagination (`pageSize`,\n`cursor`), an optional date range (`startDate`/`endDate`),\nand the generic `filter` parameter (e.g. reference selection via\n`filter={\"$match\":{\"reference\":\"...\"}}`, URL-encoded). Requires\n`ledger:ReadTransaction` scope.\n\nThis is a live read, linearizable by default. `X-Consistency: stale`\nreads the receiving node's local state, which may lag the leader. Every\nprojection used by the filter is automatically aligned. Unlike the\ngRPC API, it does not accept the `checkpointId` option to pin the read\nto a specific historical snapshot — use gRPC for checkpoint-pinned\nreads. (Tracked follow-up, same carve-out as the audit reads.)\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Transactions",
  "queryParams": [
    {
      "name": "reverse",
      "description": "Reverse the default order. Default (`false`) returns\nnewest-first (descending); `true` returns oldest-first\n(ascending). Mirrors the gRPC `ListTransactions` reverse\nflag semantic.\n",
      "required": false
    },
    {
      "name": "startDate",
      "description": "Filter transactions with timestamp >= startDate (inclusive, RFC3339 format).\nRequires the builtin `TX_BUILTIN_INDEX_TIMESTAMP` index to be enabled on the ledger.\n",
      "required": false
    },
    {
      "name": "endDate",
      "description": "Filter transactions with timestamp < endDate (exclusive, RFC3339 format).\nRequires the builtin `TX_BUILTIN_INDEX_TIMESTAMP` index to be enabled on the ledger.\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Transactions retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_TransactionResponse",
            "required": true
          },
          {
            "name": "next",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "previous",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "hasMore",
            "type": "boolean",
            "description": "True when a following page exists; set iff `next` is.",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getTransaction_ledgerV3"></a>

### GET /api/ledger/v3/{ledgerName}/transactions/{transactionId}

Get a transaction

Retrieves a transaction by its ID from the specified ledger. Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/transactions/{transactionId}",
  "summary": "Get a transaction",
  "description": "Retrieves a transaction by its ID from the specified ledger. Requires `ledger:read` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Transactions",
  "responses": [
    {
      "code": "200",
      "description": "Transaction retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetTransactionResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "transaction",
                  "type": "ledgerV3_TransactionResponse",
                  "required": true
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listAccounts_ledgerV3"></a>

### GET /api/ledger/v3/{ledgerName}/accounts

List accounts

Lists accounts in a ledger in alphabetical order with cursor
pagination and an optional generic `filter` (e.g. address-prefix
selection via `filter=address ^= "users:"`). Requires `ledger:read`
scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/accounts",
  "summary": "List accounts",
  "description": "Lists accounts in a ledger in alphabetical order with cursor\npagination and an optional generic `filter` (e.g. address-prefix\nselection via `filter=address ^= \"users:\"`). Requires `ledger:read`\nscope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Accounts",
  "queryParams": [
    {
      "name": "reverse",
      "description": "Reverse the default order. Default (`false`) returns accounts in\nalphabetical order; `true` returns reverse alphabetical order.\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "List of accounts",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_Account",
            "required": true
          },
          {
            "name": "next",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "previous",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "hasMore",
            "type": "boolean",
            "description": "True when a following page exists; set iff `next` is.",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getAccount_ledgerV3"></a>

### GET /api/ledger/v3/{ledgerName}/accounts/{address}

Get an account

Retrieves account information including metadata for a specific account address. Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/accounts/{address}",
  "summary": "Get an account",
  "description": "Retrieves account information including metadata for a specific account address. Requires `ledger:read` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Accounts",
  "queryParams": [
    {
      "name": "collapseColors",
      "description": "When true, every colored bucket of the same asset is summed\ninto a single AccountVolume entry with color = \"\". By default\neach (asset, color) tuple is returned as its own entry.\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Account retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetAccountResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_Account",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-aggregateVolumes"></a>

### GET /api/ledger/v3/{ledgerName}/volumes

Aggregate volumes

Returns aggregated volumes (input/output/balance per asset) across all accounts in the ledger.
Supports filtering accounts with the generic `filter` parameter, grouping by account prefixes,
and max-precision merging.
Requires `ledger:ReadAccount` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/volumes",
  "summary": "Aggregate volumes",
  "description": "Returns aggregated volumes (input/output/balance per asset) across all accounts in the ledger.\nSupports filtering accounts with the generic `filter` parameter, grouping by account prefixes,\nand max-precision merging.\nRequires `ledger:ReadAccount` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Balances & Volumes",
  "queryParams": [
    {
      "name": "useMaxPrecision",
      "description": "Merge assets with the same base at the highest observed precision",
      "required": false
    },
    {
      "name": "groupByPrefixes",
      "description": "Comma-separated list of account prefixes to group volumes by",
      "required": false
    },
    {
      "name": "collapseColors",
      "description": "When true, every colored bucket of the same (asset, precision) is\nsummed and the resulting AggregatedVolume entry carries color = \"\".\nBy default the response is segregated per (asset, color).\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Aggregated volumes retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_AggregateVolumesResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_AggregateVolumesData",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-saveLedgerMetadata"></a>

### POST /api/ledger/v3/{ledgerName}/metadata

Save ledger metadata

Saves metadata key-value pairs on the ledger itself. Requires `ledger:WriteMetadata`; `ledger:write` grants it under the default scope mapping. Custom scope mappings can differ.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/metadata",
  "summary": "Save ledger metadata",
  "description": "Saves metadata key-value pairs on the ledger itself. Requires `ledger:WriteMetadata`; `ledger:write` grants it under the default scope mapping. Custom scope mappings can differ.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Metadata",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "description": "Metadata key-value pairs (supports typed values)"
    }
  },
  "responses": [
    {
      "code": "204",
      "description": "Ledger metadata saved successfully"
    }
  ]
}
```

<a id="ledger-deleteLedgerMetadata"></a>

### DELETE /api/ledger/v3/{ledgerName}/metadata/{key}

Delete ledger metadata

Deletes a metadata key from the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}/metadata/{key}",
  "summary": "Delete ledger metadata",
  "description": "Deletes a metadata key from the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Metadata",
  "responses": [
    {
      "code": "204",
      "description": "Ledger metadata deleted successfully"
    }
  ]
}
```

<a id="ledger-saveAccountMetadata"></a>

### POST /api/ledger/v3/{ledgerName}/accounts/{address}/metadata

Save account metadata

Saves metadata for a specific account in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/accounts/{address}/metadata",
  "summary": "Save account metadata",
  "description": "Saves metadata for a specific account in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Accounts",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "description": "Metadata key-value pairs (supports typed values)"
    }
  },
  "responses": [
    {
      "code": "204",
      "description": "Account metadata saved successfully"
    }
  ]
}
```

<a id="ledger-saveTransactionMetadata"></a>

### POST /api/ledger/v3/{ledgerName}/transactions/{transactionId}/metadata

Save transaction metadata

Saves metadata for a specific transaction in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/transactions/{transactionId}/metadata",
  "summary": "Save transaction metadata",
  "description": "Saves metadata for a specific transaction in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Transactions",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "description": "Metadata key-value pairs (supports typed values)"
    }
  },
  "responses": [
    {
      "code": "204",
      "description": "Transaction metadata saved successfully"
    }
  ]
}
```

<a id="ledger-deleteAccountMetadata"></a>

### DELETE /api/ledger/v3/{ledgerName}/accounts/{address}/metadata/{key}

Delete account metadata

Deletes a metadata key for a specific account in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}/accounts/{address}/metadata/{key}",
  "summary": "Delete account metadata",
  "description": "Deletes a metadata key for a specific account in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Accounts",
  "responses": [
    {
      "code": "204",
      "description": "Account metadata deleted successfully"
    }
  ]
}
```

<a id="ledger-deleteTransactionMetadata"></a>

### DELETE /api/ledger/v3/{ledgerName}/transactions/{transactionId}/metadata/{key}

Delete transaction metadata

Deletes a metadata key for a specific transaction in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}/transactions/{transactionId}/metadata/{key}",
  "summary": "Delete transaction metadata",
  "description": "Deletes a metadata key for a specific transaction in the ledger. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Transactions",
  "responses": [
    {
      "code": "204",
      "description": "Transaction metadata deleted successfully"
    }
  ]
}
```

<a id="ledger-revertTransaction_ledgerV3"></a>

### POST /api/ledger/v3/{ledgerName}/transactions/{transactionId}/revert

Revert a transaction

Reverts a transaction by creating a reverse transaction that undoes its effects. Requires `ledger:write` scope.
The body is optional; an absent or empty body uses default options. Supplied
options and metadata are decoded for both known-length and HTTP/1.1 chunked
requests. Malformed or truncated JSON, extra values, trailing non-whitespace
and options of the wrong JSON type (for example `"atEffectiveDate": "true"`
or a non-object `metadata`) return 400 before applying the revert. A JSON
`null` option uses its default. The complete body, including trailing
whitespace, counts towards the 4 MiB limit; exceeding it returns 413.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/transactions/{transactionId}/revert",
  "summary": "Revert a transaction",
  "description": "Reverts a transaction by creating a reverse transaction that undoes its effects. Requires `ledger:write` scope.\nThe body is optional; an absent or empty body uses default options. Supplied\noptions and metadata are decoded for both known-length and HTTP/1.1 chunked\nrequests. Malformed or truncated JSON, extra values, trailing non-whitespace\nand options of the wrong JSON type (for example `\"atEffectiveDate\": \"true\"`\nor a non-object `metadata`) return 400 before applying the revert. A JSON\n`null` option uses its default. The complete body, including trailing\nwhitespace, counts towards the 4 MiB limit; exceeding it returns 413.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Transactions",
  "requestBody": {
    "mediaType": "application/json",
    "schema": {
      "type": "object",
      "ref": "ledgerV3_RevertTransactionRequestBody",
      "properties": [
        {
          "name": "force",
          "type": "boolean",
          "description": "Force revert even if accounts don't have sufficient funds"
        },
        {
          "name": "atEffectiveDate",
          "type": "boolean",
          "description": "Set the timestamp of the reverted transaction to the original transaction timestamp"
        },
        {
          "name": "metadata",
          "type": "object",
          "description": "Metadata for the revert transaction (supports typed values). Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy."
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Transaction reverted successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_RevertedTransactionResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_RevertedTransaction",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getMetadataSchemaStatus"></a>

### GET /api/ledger/v3/{ledgerName}/metadata-schema

Get metadata schema

Returns the declared type of every metadata field on a ledger. Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/metadata-schema",
  "summary": "Get metadata schema",
  "description": "Returns the declared type of every metadata field on a ledger. Requires `ledger:read` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Metadata",
  "responses": [
    {
      "code": "200",
      "description": "Metadata schema status retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_MetadataSchemaStatusResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "accountFields",
                  "type": "object",
                  "description": "Account metadata field declarations",
                  "required": true
                },
                {
                  "name": "transactionFields",
                  "type": "object",
                  "description": "Transaction metadata field declarations",
                  "required": true
                },
                {
                  "name": "ledgerFields",
                  "type": "object",
                  "description": "Ledger metadata field declarations",
                  "required": true
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-inspectIndex"></a>

### GET /api/ledger/v3/{ledgerName}/indexes/{canonicalId}/inspect

Inspect a metadata index

Scans a metadata index and returns distinct values, facets (value + count),
or a summary (cardinality, min/max, existence counts). The index must be
in READY state. Only metadata indexes are inspectable (builtin indexes
return 400). Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/indexes/{canonicalId}/inspect",
  "summary": "Inspect a metadata index",
  "description": "Scans a metadata index and returns distinct values, facets (value + count),\nor a summary (cardinality, min/max, existence counts). The index must be\nin READY state. Only metadata indexes are inspectable (builtin indexes\nreturn 400). Requires `ledger:read` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "pathParams": [
    {
      "name": "canonicalId",
      "description": "Canonical form of the target IndexID, e.g.\n`metadata:TARGET_TYPE_ACCOUNT:color`. Must resolve to a metadata\nindex; builtin indexes (`tx_builtin:...`, etc.) are rejected.\n"
    }
  ],
  "queryParams": [
    {
      "name": "mode",
      "description": "Inspection mode. The deprecated distinct-values alias for distinctValues remains accepted. An explicitly empty or unsupported value returns 400.",
      "required": false
    },
    {
      "name": "pageSize",
      "description": "Page size for distinctValues/facets modes (defaults to 100 when\nomitted). Any supplied value must be in 1..10000, including in\nsummary mode, which does not use pagination. Empty or invalid\nvalues return 400.\n",
      "required": false
    },
    {
      "name": "cursor",
      "description": "Page token from a previous response's `nextCursor` or\n`previousCursor`, for distinctValues/facets modes (see the\n`PageToken` schema; the key is the base64url encoding of the\nmetadata value). Omit for the first page.\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Index inspection result",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "oneOf",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "oneOf": [
                {
                  "type": "object",
                  "ref": "ledgerV3_InspectSummaryResponse",
                  "properties": [
                    {
                      "name": "cardinality",
                      "type": "integer (uint64)",
                      "description": "Number of distinct values",
                      "required": true
                    },
                    {
                      "name": "min",
                      "type": "any",
                      "description": "Minimum value (null if index is empty)"
                    },
                    {
                      "name": "max",
                      "type": "any",
                      "description": "Maximum value (null if index is empty)"
                    },
                    {
                      "name": "entitiesWithKey",
                      "type": "integer (uint64)",
                      "description": "Number of entities that have this metadata key set (non-null)",
                      "required": true
                    },
                    {
                      "name": "entitiesWithNull",
                      "type": "integer (uint64)",
                      "description": "Number of entities with a null value for this key",
                      "required": true
                    }
                  ]
                },
                {
                  "type": "object",
                  "ref": "ledgerV3_InspectDistinctValuesResponse",
                  "properties": [
                    {
                      "name": "values",
                      "type": "array",
                      "description": "Distinct values in sorted order",
                      "required": true
                    },
                    {
                      "name": "hasMore",
                      "type": "boolean",
                      "description": "Whether more values are available; set iff `nextCursor` is",
                      "required": true
                    },
                    {
                      "name": "nextCursor",
                      "type": "ledgerV3_PageToken"
                    },
                    {
                      "name": "previousCursor",
                      "type": "ledgerV3_PageToken"
                    }
                  ]
                },
                {
                  "type": "object",
                  "ref": "ledgerV3_InspectFacetsResponse",
                  "properties": [
                    {
                      "name": "facets",
                      "type": "array of ledgerV3_InspectFacet",
                      "description": "Facets sorted by value",
                      "required": true
                    },
                    {
                      "name": "hasMore",
                      "type": "boolean",
                      "description": "Whether more facets are available; set iff `nextCursor` is",
                      "required": true
                    },
                    {
                      "name": "nextCursor",
                      "type": "ledgerV3_PageToken"
                    },
                    {
                      "name": "previousCursor",
                      "type": "ledgerV3_PageToken"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-analyzeAccounts"></a>

### GET /api/ledger/v3/{ledgerName}/analyze-accounts

Analyze accounts and suggest a Chart of Accounts

Scans all accounts in a ledger, discovers address patterns, and returns a
suggested Chart of Accounts. Useful after a mirror import to understand
account structure. Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/analyze-accounts",
  "summary": "Analyze accounts and suggest a Chart of Accounts",
  "description": "Scans all accounts in a ledger, discovers address patterns, and returns a\nsuggested Chart of Accounts. Useful after a mirror import to understand\naccount structure. Requires `ledger:read` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Query Analysis",
  "queryParams": [
    {
      "name": "variableThreshold",
      "description": "Max distinct children before classifying as variable (0 = default 10)",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Analysis completed successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_AnalyzeAccountsResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "patterns",
                  "type": "array of ledgerV3_AccountPattern"
                },
                {
                  "name": "totalAccounts",
                  "type": "integer (int64)"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-analyzeTransactions"></a>

### GET /api/ledger/v3/{ledgerName}/analyze-transactions

Analyze transaction flow patterns

Scans all transactions in a ledger, discovers flow patterns by normalizing
account addresses, and returns statistics per flow type including temporal
distribution and volume metrics. Requires `ledger:read` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/analyze-transactions",
  "summary": "Analyze transaction flow patterns",
  "description": "Scans all transactions in a ledger, discovers flow patterns by normalizing\naccount addresses, and returns statistics per flow type including temporal\ndistribution and volume metrics. Requires `ledger:read` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Query Analysis",
  "queryParams": [
    {
      "name": "variableThreshold",
      "description": "Max distinct children before classifying as variable (0 = default 10)",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Analysis completed successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_AnalyzeTransactionsResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "flowPatterns",
                  "type": "array of ledgerV3_FlowPattern"
                },
                {
                  "name": "totalTransactions",
                  "type": "integer (int64)"
                },
                {
                  "name": "totalReverted",
                  "type": "integer (int64)"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-setMetadataFieldType"></a>

### PUT /api/ledger/v3/{ledgerName}/metadata-schema/{targetType}/{key}

Set metadata field type

Declares or changes the type used to encode a metadata key in an attached query index.
Metadata values are neither validated nor converted by this declaration, and existing primary values remain unchanged.
Any attached index is rewritten asynchronously. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).

```json
{
  "method": "PUT",
  "path": "/api/ledger/v3/{ledgerName}/metadata-schema/{targetType}/{key}",
  "summary": "Set metadata field type",
  "description": "Declares or changes the type used to encode a metadata key in an attached query index.\nMetadata values are neither validated nor converted by this declaration, and existing primary values remain unchanged.\nAny attached index is rewritten asynchronously. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Metadata",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_SetMetadataTypeRequest",
      "properties": [
        {
          "name": "type",
          "type": "string",
          "description": "Metadata type to set for the field",
          "required": true,
          "enumValues": [
            "string",
            "int64",
            "bool",
            "uint64",
            "int8",
            "int16",
            "int32",
            "uint8",
            "uint16",
            "uint32",
            "datetime"
          ]
        }
      ]
    }
  },
  "responses": [
    {
      "code": "204",
      "description": "Metadata field type set successfully"
    }
  ]
}
```

<a id="ledger-removeMetadataFieldType"></a>

### DELETE /api/ledger/v3/{ledgerName}/metadata-schema/{targetType}/{key}

Remove metadata field type

Removes the type declaration for a metadata key on a ledger.
Existing metadata values remain unchanged and any attached index is dropped. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}/metadata-schema/{targetType}/{key}",
  "summary": "Remove metadata field type",
  "description": "Removes the type declaration for a metadata key on a ledger.\nExisting metadata values remain unchanged and any attached index is dropped. Requires `ledger:WriteMetadata` scope (included in the default `ledger:write` mapping).\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Metadata",
  "responses": [
    {
      "code": "204",
      "description": "Metadata field type removed successfully"
    }
  ]
}
```

<a id="ledger-analyzeNumscript"></a>

### POST /api/ledger/v3/numscripts/analyze

Analyze Numscript source

Validates Numscript v1 and returns the external input schema without reading or changing ledger state. Recognized source failures are returned as diagnostics with an empty input list. Sources over 64 KiB or with more than 32 block-comment open markers receive a syntax diagnostic; internal failures return a server error.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/numscripts/analyze",
  "summary": "Analyze Numscript source",
  "description": "Validates Numscript v1 and returns the external input schema without reading or changing ledger state. Recognized source failures are returned as diagnostics with an empty input list. Sources over 64 KiB or with more than 32 block-comment open markers receive a syntax diagnostic; internal failures return a server error.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Numscript",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_AnalyzeNumscriptRequest",
      "properties": [
        {
          "name": "source",
          "type": "string",
          "description": "UTF-8 source text, at most 64 KiB. The complete HTTP JSON body is limited to 4 MiB.",
          "required": true
        },
        {
          "name": "version",
          "type": "string",
          "description": "Numscript language version; currently v1.",
          "required": true,
          "example": "v1"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "200",
      "description": "Analysis result",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_AnalyzeNumscriptResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "inputs",
                  "type": "array of object",
                  "required": true,
                  "inlineSchema": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": [
                        {
                          "name": "name",
                          "type": "string",
                          "required": true
                        },
                        {
                          "name": "type",
                          "type": "string",
                          "description": "Numscript type spelling.",
                          "required": true
                        }
                      ]
                    }
                  }
                },
                {
                  "name": "diagnostics",
                  "type": "array of object",
                  "required": true,
                  "inlineSchema": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": [
                        {
                          "name": "kind",
                          "type": "string",
                          "required": true,
                          "enumValues": [
                            "version",
                            "syntax",
                            "feature",
                            "compile"
                          ]
                        },
                        {
                          "name": "code",
                          "type": "string",
                          "required": true
                        },
                        {
                          "name": "message",
                          "type": "string",
                          "required": true
                        },
                        {
                          "name": "startLine",
                          "type": "integer"
                        },
                        {
                          "name": "startColumn",
                          "type": "integer"
                        },
                        {
                          "name": "endLine",
                          "type": "integer"
                        },
                        {
                          "name": "endColumn",
                          "type": "integer"
                        }
                      ]
                    }
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listNumscripts"></a>

### GET /api/ledger/v3/{ledgerName}/numscripts

List all numscripts

Lists every numscript of a ledger at its greatest stored version, paged
by name (ascending unless `reverse=true`).

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/numscripts",
  "summary": "List all numscripts",
  "description": "Lists every numscript of a ledger at its greatest stored version, paged\nby name (ascending unless `reverse=true`).\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Numscript",
  "queryParams": [
    {
      "name": "reverse",
      "description": "List in descending name order when true.",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "List of numscripts retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_ListNumscriptsResponse",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_NumscriptInfo",
            "description": "One page of numscripts, in the requested name order",
            "required": true
          },
          {
            "name": "next",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "previous",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "hasMore",
            "type": "boolean",
            "description": "True when a following page exists; set iff `next` is.",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getNumscript"></a>

### GET /api/ledger/v3/{ledgerName}/numscripts/{name}

Get a numscript

Retrieves a numscript by name from a ledger. Use the `version` query parameter to get a specific
semver version. If omitted or empty, the latest version is returned.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/numscripts/{name}",
  "summary": "Get a numscript",
  "description": "Retrieves a numscript by name from a ledger. Use the `version` query parameter to get a specific\nsemver version. If omitted or empty, the latest version is returned.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Numscript",
  "pathParams": [
    {
      "name": "name",
      "description": "Name of the numscript, URL-encoded as one path segment. Decoded exactly once."
    }
  ],
  "queryParams": [
    {
      "name": "version",
      "description": "Semver version to retrieve (e.g. \"1.0.0\"). If omitted or empty, the latest version is returned.\n",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Numscript retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetNumscriptResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_NumscriptInfo",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-saveNumscript"></a>

### PUT /api/ledger/v3/{ledgerName}/numscripts/{name}

Save a numscript

Appends an immutable version to a ledger's numscript library. The `version`
field must be an explicit full semver (e.g. "1.0.0"); it creates a new
version and fails if that version already exists. The per-name latest is
always the greatest stored semver.

```json
{
  "method": "PUT",
  "path": "/api/ledger/v3/{ledgerName}/numscripts/{name}",
  "summary": "Save a numscript",
  "description": "Appends an immutable version to a ledger's numscript library. The `version`\nfield must be an explicit full semver (e.g. \"1.0.0\"); it creates a new\nversion and fails if that version already exists. The per-name latest is\nalways the greatest stored semver.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Numscript",
  "pathParams": [
    {
      "name": "name",
      "description": "Name of the numscript, URL-encoded as one path segment. Decoded exactly once."
    }
  ],
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_SaveNumscriptRequest",
      "properties": [
        {
          "name": "content",
          "type": "string",
          "description": "The numscript source code",
          "required": true
        },
        {
          "name": "version",
          "type": "string",
          "description": "Explicit full semver (e.g. \"1.0.0\"). Appends a new immutable version;\nfails if that version already exists. \"latest\" and partial selectors\nare not accepted for save.\n",
          "required": true,
          "example": "1.0.0"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Numscript saved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetNumscriptResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_NumscriptInfo",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listNumscriptVersions"></a>

### GET /api/ledger/v3/{ledgerName}/numscripts/{name}/versions

List numscript versions

Returns the numscript's history: its current latest (greatest stored
semver) and every stored version, highest-first.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/numscripts/{name}/versions",
  "summary": "List numscript versions",
  "description": "Returns the numscript's history: its current latest (greatest stored\nsemver) and every stored version, highest-first.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Numscript",
  "pathParams": [
    {
      "name": "name",
      "description": "Name of the numscript, URL-encoded as one path segment. Decoded exactly once."
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Numscript versions retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_ListNumscriptVersionsResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "latestVersion",
                  "type": "string",
                  "description": "The current latest — the greatest stored semver",
                  "example": "2.0.0"
                },
                {
                  "name": "versions",
                  "type": "array of ledgerV3_NumscriptVersionEntry",
                  "description": "Every stored version, highest-first"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getNumscriptUsage"></a>

### GET /api/ledger/v3/{ledgerName}/numscripts/{name}/usage

Get template usage

Returns the invocation counter and last-used timestamp for a Numscript template. Values are
materialised asynchronously by the `usagebuilder` subsystem from the FSM audit chain and may
lag the live FSM while the worker drains pending batches. A never-invoked template returns a
zero-valued response (not 404), so clients handle "never used" uniformly.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/numscripts/{name}/usage",
  "summary": "Get template usage",
  "description": "Returns the invocation counter and last-used timestamp for a Numscript template. Values are\nmaterialised asynchronously by the `usagebuilder` subsystem from the FSM audit chain and may\nlag the live FSM while the worker drains pending batches. A never-invoked template returns a\nzero-valued response (not 404), so clients handle \"never used\" uniformly.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Numscript",
  "pathParams": [
    {
      "name": "name",
      "description": "Name of the numscript template, URL-encoded as one path segment. Decoded exactly once."
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Template usage retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetTemplateUsageResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_TemplateUsage",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-bulkOperations"></a>

### POST /api/ledger/v3/{ledgerName}/bulk

Bulk operations

Execute multiple operations (create transactions, add metadata,
revert transactions, delete metadata) in a single request. Requires
`ledger:write` scope.

With `atomic=true`, all elements target the URL's ledger and are
submitted as one batch. `Idempotency-Key` identifies that whole batch;
per-element `ik` values are ignored. With `atomic=false`
(default), each element is submitted separately under its own
`ik`; the header is ignored.

`continueOnFailure` controls sequential continuation and business-error
status rollup. It does not allow partial application of an atomic
batch. Non-atomic failures can follow already committed elements:
inspect every result and preserve the original identities when retrying.
A timeout or infrastructure failure does not prove that work was not
committed. This contract does not enable automatic SDK retries.

The response status is decided in three tiers:

1. **Request-level failures** (before per-element processing):
   malformed body → `400`, missing/insufficient scope → `401` or
   `403`, too many elements → `413`. Exceeding the byte limit while
   decoding the body currently returns `400`.
   Returned unconditionally, `continueOnFailure` does not apply.
2. **Infrastructure failures during processing** (transport
   timeout, cache-horizon exceeded, storage error): the overall
   status is `503` for retryable failures and `500` otherwise,
   regardless of `continueOnFailure`. Callers
   must inspect the element outcomes before deciding what to retry.
3. **Per-element errors during processing**: each element's error
   carries the HTTP status it would surface as a single request
   (via the same mapping `handleError` uses). The top-level
   status is the "worst" of them, with `continueOnFailure`
   applying only to per-element business failures (4xx):
   - Business failures (validation, not-found, conflict,
     precondition, permission — 4xx): rolled up per
     `continueOnFailure`. `true` → `200`; `false` (default) →
     the highest 4xx among failing elements (typically `400`).
   - Resource exhaustion (`KindResourceExhausted`, `429`), including
     rate limits and permanent authoritative-sequence exhaustion:
     surface unconditionally as `429`.
   - Retryable infrastructure failures (leader loss,
     cache-horizon exceeded, `KindUnavailable`): surface as
     `503` with `Retry-After: 1`, regardless of
     `continueOnFailure`.
   - Non-retryable infrastructure failures (transport / storage
     errors, `KindInternal`, unclassified): surface as `500`.
   - Aborted elements (`context.Canceled` from the sequential
     runner after a prior failure): contribute nothing — the
     originating error drives the rollup.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/bulk",
  "summary": "Bulk operations",
  "description": "Execute multiple operations (create transactions, add metadata,\nrevert transactions, delete metadata) in a single request. Requires\n`ledger:write` scope.\n\nWith `atomic=true`, all elements target the URL's ledger and are\nsubmitted as one batch. `Idempotency-Key` identifies that whole batch;\nper-element `ik` values are ignored. With `atomic=false`\n(default), each element is submitted separately under its own\n`ik`; the header is ignored.\n\n`continueOnFailure` controls sequential continuation and business-error\nstatus rollup. It does not allow partial application of an atomic\nbatch. Non-atomic failures can follow already committed elements:\ninspect every result and preserve the original identities when retrying.\nA timeout or infrastructure failure does not prove that work was not\ncommitted. This contract does not enable automatic SDK retries.\n\nThe response status is decided in three tiers:\n\n1. **Request-level failures** (before per-element processing):\n   malformed body → `400`, missing/insufficient scope → `401` or\n   `403`, too many elements → `413`. Exceeding the byte limit while\n   decoding the body currently returns `400`.\n   Returned unconditionally, `continueOnFailure` does not apply.\n2. **Infrastructure failures during processing** (transport\n   timeout, cache-horizon exceeded, storage error): the overall\n   status is `503` for retryable failures and `500` otherwise,\n   regardless of `continueOnFailure`. Callers\n   must inspect the element outcomes before deciding what to retry.\n3. **Per-element errors during processing**: each element's error\n   carries the HTTP status it would surface as a single request\n   (via the same mapping `handleError` uses). The top-level\n   status is the \"worst\" of them, with `continueOnFailure`\n   applying only to per-element business failures (4xx):\n   - Business failures (validation, not-found, conflict,\n     precondition, permission — 4xx): rolled up per\n     `continueOnFailure`. `true` → `200`; `false` (default) →\n     the highest 4xx among failing elements (typically `400`).\n   - Resource exhaustion (`KindResourceExhausted`, `429`), including\n     rate limits and permanent authoritative-sequence exhaustion:\n     surface unconditionally as `429`.\n   - Retryable infrastructure failures (leader loss,\n     cache-horizon exceeded, `KindUnavailable`): surface as\n     `503` with `Retry-After: 1`, regardless of\n     `continueOnFailure`.\n   - Non-retryable infrastructure failures (transport / storage\n     errors, `KindInternal`, unclassified): surface as `500`.\n   - Aborted elements (`context.Canceled` from the sequential\n     runner after a prior failure): contribute nothing — the\n     originating error drives the rollup.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Bulk Operations",
  "queryParams": [
    {
      "name": "continueOnFailure",
      "description": "Continue sequential processing after a failure and suppress the\ntop-level status for business errors. Does not suppress 429 or 5xx\nfailures, or permit partial application when atomic=true.\n",
      "required": false
    },
    {
      "name": "atomic",
      "description": "Submit all operations as one atomic batch under the optional\nIdempotency-Key header. Per-element ik values are ignored.\nAll elements target ledgerName. On failure every element reports\nthe batch error; continueOnFailure does not change atomicity.\n",
      "required": false
    }
  ],
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "array",
      "items": {
        "type": "object",
        "ref": "ledgerV3_BulkElement",
        "properties": [
          {
            "name": "action",
            "type": "string",
            "description": "The type of operation to perform. The REST bulk endpoint accepts\nthese four actions only; account-type actions\n(`ADD_ACCOUNT_TYPE` / `REMOVE_ACCOUNT_TYPE`) are gRPC-only and\nare rejected here.\n",
            "required": true,
            "enumValues": [
              "CREATE_TRANSACTION",
              "ADD_METADATA",
              "REVERT_TRANSACTION",
              "DELETE_METADATA"
            ]
          },
          {
            "name": "ik",
            "type": "string",
            "description": "Idempotency key for this operation"
          },
          {
            "name": "data",
            "type": "oneOf",
            "description": "Operation-specific data",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "description": "Operation-specific data",
              "oneOf": [
                {
                  "type": "object",
                  "ref": "ledgerV3_CreateTransactionRequest",
                  "description": "A transaction must declare exactly one content source: explicit\n`postings`, an inline `script`, or a `scriptReference`. The\n`postings` array cannot be combined with `script` or\n`scriptReference`. Idempotency is controlled exclusively via the\n`Idempotency-Key` HTTP header — there is no body-level key.\n",
                  "properties": [
                    {
                      "name": "accountMetadata",
                      "type": "object",
                      "description": "Metadata for accounts involved in the transaction (supports typed values). Account addresses must be nonempty and contain only letters, digits, colons, underscores and hyphens, without empty segments. Malformed addresses are rejected before submission; competing invalid addresses select the lexicographically smallest address. Each account's map is bounded independently. Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy."
                    },
                    {
                      "name": "timestamp",
                      "type": "string (date-time)",
                      "description": "Transaction timestamp (ISO 8601 format). If not provided, current time is used."
                    },
                    {
                      "name": "metadata",
                      "type": "object",
                      "description": "Transaction metadata (supports typed values). Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy."
                    },
                    {
                      "name": "reference",
                      "type": "string",
                      "description": "Transaction reference"
                    },
                    {
                      "name": "postings",
                      "type": "array of ledgerV3_PostingRequest",
                      "description": "List of postings for the transaction. Mutually exclusive with `script` and `scriptReference`."
                    },
                    {
                      "name": "script",
                      "type": "ledgerV3_Script",
                      "description": "Inline Numscript to execute. Mutually exclusive with `postings` and `scriptReference`."
                    },
                    {
                      "name": "scriptReference",
                      "type": "ledgerV3_ScriptReference",
                      "description": "Reference to a numscript saved in the ledger's library. Mutually exclusive with `postings` and `script`."
                    },
                    {
                      "name": "force",
                      "type": "boolean",
                      "description": "Skip the balance check, so the transaction commits even when a source account has insufficient funds."
                    }
                  ]
                },
                {
                  "type": "object",
                  "ref": "ledgerV3_AddMetadataRequest",
                  "properties": [
                    {
                      "name": "targetType",
                      "type": "string",
                      "description": "Type of target (account or transaction)",
                      "required": true,
                      "enumValues": [
                        "ACCOUNT",
                        "TRANSACTION"
                      ]
                    },
                    {
                      "name": "targetId",
                      "type": "oneOf",
                      "description": "ID of the target (account address or transaction ID). Required.\n",
                      "required": true,
                      "inlineSchema": {
                        "type": "object",
                        "description": "ID of the target (account address or transaction ID). Required.\n",
                        "oneOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "integer"
                          }
                        ]
                      }
                    },
                    {
                      "name": "metadata",
                      "type": "object",
                      "description": "Metadata to add (supports typed values). Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy.",
                      "required": true
                    }
                  ]
                },
                {
                  "type": "object",
                  "ref": "ledgerV3_RevertTransactionRequest",
                  "properties": [
                    {
                      "name": "id",
                      "type": "integer (int64)",
                      "description": "Transaction ID to revert. Required.",
                      "required": true
                    },
                    {
                      "name": "force",
                      "type": "boolean",
                      "description": "Force revert even if accounts don't have sufficient funds"
                    },
                    {
                      "name": "atEffectiveDate",
                      "type": "boolean",
                      "description": "Set the timestamp of the reverted transaction to the original transaction timestamp"
                    },
                    {
                      "name": "metadata",
                      "type": "object",
                      "description": "Metadata for the revert transaction (supports typed values). Cluster policy defaults allow 128 entries per entity, 256 bytes per key, 16384 bytes per value, 65536 bytes per entity, and 1048576 bytes per request. Effective ceilings are configurable through the replicated cluster policy."
                    }
                  ]
                },
                {
                  "type": "object",
                  "ref": "ledgerV3_DeleteMetadataRequest",
                  "properties": [
                    {
                      "name": "targetType",
                      "type": "string",
                      "description": "Type of target (account or transaction)",
                      "required": true,
                      "enumValues": [
                        "ACCOUNT",
                        "TRANSACTION"
                      ]
                    },
                    {
                      "name": "targetId",
                      "type": "oneOf",
                      "description": "ID of the target (account address or transaction ID). Required.\n",
                      "required": true,
                      "inlineSchema": {
                        "type": "object",
                        "description": "ID of the target (account address or transaction ID). Required.\n",
                        "oneOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "integer"
                          }
                        ]
                      }
                    },
                    {
                      "name": "key",
                      "type": "string",
                      "description": "Metadata key to delete",
                      "required": true
                    }
                  ]
                }
              ]
            }
          },
          {
            "name": "skippableReasons",
            "type": "array of string",
            "description": "Opt-in continue-on-failure list for this entry. When the FSM\nwould otherwise reject the underlying order with a business\nerror whose typed reason matches one of these entries, the\norder is recorded as an `OrderSkippedLog` (no state mutation)\nand the bulk result's `data` surfaces the skip context.\nReasons outside the per-action business whitelist (structural\n/ internal reasons) are rejected at admission. Accepted\nreasons per action on this REST endpoint:\n  - `CREATE_TRANSACTION` → `TRANSACTION_REFERENCE_CONFLICT`\n  - `REVERT_TRANSACTION` → `TRANSACTION_ALREADY_REVERTED`\n  - `DELETE_METADATA`    → `METADATA_NOT_FOUND`\nThe FSM also supports skipping `ADD_ACCOUNT_TYPE`\n(`ACCOUNT_TYPE_ALREADY_EXISTS`) and `REMOVE_ACCOUNT_TYPE`\n(`ACCOUNT_TYPE_NOT_FOUND`), but those actions are **gRPC-only**:\nthe REST bulk endpoint does not accept account-type actions (see\nthe `action` enum above), so their reasons are not offered here.\nEmpty (default) preserves the historical fail-on-error\nbehaviour.\n"
          }
        ]
      }
    }
  },
  "responses": [
    {
      "code": "200",
      "description": "Bulk operations completed",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_BulkResponse",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_BulkResult"
          },
          {
            "name": "errorCode",
            "type": "string"
          },
          {
            "name": "errorMessage",
            "type": "string"
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-createPreparedQuery"></a>

### POST /api/ledger/v3/{ledgerName}/prepared-queries

Create a prepared query

Creates a new prepared query for a ledger. A prepared query defines a reusable
filter that can be executed later with parameter substitution. Requires `ledger:WriteQuery` scope.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/prepared-queries",
  "summary": "Create a prepared query",
  "description": "Creates a new prepared query for a ledger. A prepared query defines a reusable\nfilter that can be executed later with parameter substitution. Requires `ledger:WriteQuery` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Prepared Queries",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_CreatePreparedQueryRequest",
      "properties": [
        {
          "name": "name",
          "type": "string",
          "description": "Unique name for the prepared query",
          "required": true
        },
        {
          "name": "target",
          "type": "string",
          "description": "Target entity type. `LOGS` queries return log entries; the log-only filter fields (`logId`, `date`, `ledger`) are valid only when the target is `LOGS`.",
          "required": true,
          "enumValues": [
            "ACCOUNTS",
            "TRANSACTIONS",
            "LOGS"
          ]
        },
        {
          "name": "filter",
          "type": "ledgerV3_PreparedQueryFilterInput",
          "description": "Optional filter. Omit it or set it to `null` to create a match-all query for the selected target. An empty object or empty textual expression is invalid."
        }
      ]
    }
  },
  "responses": [
    {
      "code": "204",
      "description": "Prepared query created successfully"
    }
  ]
}
```

<a id="ledger-listPreparedQueries"></a>

### GET /api/ledger/v3/{ledgerName}/prepared-queries

List prepared queries

Returns a list of all prepared queries for a ledger. Requires `ledger:ReadQuery` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/prepared-queries",
  "summary": "List prepared queries",
  "description": "Returns a list of all prepared queries for a ledger. Requires `ledger:ReadQuery` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Prepared Queries",
  "responses": [
    {
      "code": "200",
      "description": "List of prepared queries retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_ListPreparedQueriesResponse",
        "properties": [
          {
            "name": "data",
            "type": "array of ledgerV3_PreparedQuery",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-updatePreparedQuery"></a>

### PUT /api/ledger/v3/{ledgerName}/prepared-queries/{queryName}

Update a prepared query

Updates the filter of an existing prepared query. Requires `ledger:WriteQuery` scope.

```json
{
  "method": "PUT",
  "path": "/api/ledger/v3/{ledgerName}/prepared-queries/{queryName}",
  "summary": "Update a prepared query",
  "description": "Updates the filter of an existing prepared query. Requires `ledger:WriteQuery` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Prepared Queries",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_UpdatePreparedQueryRequest",
      "properties": [
        {
          "name": "filter",
          "type": "ledgerV3_PreparedQueryFilterInput",
          "description": "Replacement filter. Omit the field to leave the stored filter unchanged; set it to `null` to remove the filter and make the query match all entities in its target. An empty object or empty textual expression is invalid."
        }
      ]
    }
  },
  "responses": [
    {
      "code": "204",
      "description": "Prepared query updated successfully"
    }
  ]
}
```

<a id="ledger-deletePreparedQuery"></a>

### DELETE /api/ledger/v3/{ledgerName}/prepared-queries/{queryName}

Delete a prepared query

Deletes a prepared query from a ledger. Requires `ledger:WriteQuery` scope.

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}/prepared-queries/{queryName}",
  "summary": "Delete a prepared query",
  "description": "Deletes a prepared query from a ledger. Requires `ledger:WriteQuery` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Prepared Queries",
  "responses": [
    {
      "code": "204",
      "description": "Prepared query deleted successfully"
    }
  ]
}
```

<a id="ledger-executePreparedQuery"></a>

### POST /api/ledger/v3/{ledgerName}/prepared-queries/{queryName}/execute

Execute a prepared query

Executes a prepared query with optional parameter substitution. Supports LIST and
AGGREGATE\_VOLUMES modes. LIST uses cursor pagination with an effective page size
of 100 when omitted or zero, capped at 1000 before collecting and enriching rows.
AGGREGATE\_VOLUMES ignores pageSize and aggregates all matching accounts. Also
accepts pageSize, cursor and reverse as query parameters. Supplied pageSize and
reverse values, and nonempty cursor values, override the body. Requires `ledger:ReadQuery` scope.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/prepared-queries/{queryName}/execute",
  "summary": "Execute a prepared query",
  "description": "Executes a prepared query with optional parameter substitution. Supports LIST and\nAGGREGATE_VOLUMES modes. LIST uses cursor pagination with an effective page size\nof 100 when omitted or zero, capped at 1000 before collecting and enriching rows.\nAGGREGATE_VOLUMES ignores pageSize and aggregates all matching accounts. Also\naccepts pageSize, cursor and reverse as query parameters. Supplied pageSize and\nreverse values, and nonempty cursor values, override the body. Requires `ledger:ReadQuery` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Prepared Queries",
  "queryParams": [
    {
      "name": "pageSize",
      "description": "LIST page size. A supplied value overrides the body, including empty or\nzero (default 100). The effective maximum is 1000; larger uint32 values\nare accepted and clamped, not rejected. Ignored for AGGREGATE_VOLUMES.\n",
      "required": false
    },
    {
      "name": "cursor",
      "description": "Page token from a previous response's `cursor.next` or\n`cursor.previous` (see the `PageToken` schema). Overrides the body\nvalue.\n",
      "required": false
    },
    {
      "name": "reverse",
      "description": "List in descending entity order when true (overrides body value)",
      "required": false
    }
  ],
  "requestBody": {
    "mediaType": "application/json",
    "schema": {
      "type": "object",
      "ref": "ledgerV3_ExecutePreparedQueryRequest",
      "properties": [
        {
          "name": "parameters",
          "type": "object",
          "description": "Parameter values for the query (substituted into filter placeholders)"
        },
        {
          "name": "pageSize",
          "type": "integer (uint32)",
          "description": "LIST page size. Omitted or zero means 100. The effective maximum is\n1000; larger uint32 values are accepted and clamped, not rejected.\nA supplied query parameter overrides this value. Ignored for\nAGGREGATE_VOLUMES.\n"
        },
        {
          "name": "cursor",
          "type": "string",
          "description": "Page token from a previous response's `cursor.next` or\n`cursor.previous` (see the `PageToken` schema). The key is the\ndecimal id for TRANSACTIONS and LOGS targets, the address for\nACCOUNTS.\n"
        },
        {
          "name": "mode",
          "type": "string",
          "description": "Execution mode (default LIST)",
          "enumValues": [
            "LIST",
            "AGGREGATE_VOLUMES"
          ]
        },
        {
          "name": "reverse",
          "type": "boolean",
          "description": "List in descending entity order (address, transaction id or log id).\nA page token is relative to the requested order, so every page of a\ndescending walk must set `reverse`. Rejected with 400 in\n`AGGREGATE_VOLUMES` mode.\n"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "200",
      "description": "Query executed successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_ExecutePreparedQueryResponse",
        "description": "Result of executing a prepared query. Exactly one field is set,\ndiscriminated by the request execution `mode` (see\n`ExecutePreparedQueryRequest.mode`): `mode=LIST` returns `cursor`,\n`mode=AGGREGATE_VOLUMES` returns `aggregateResult`. (The query `target`\n— ACCOUNTS, TRANSACTIONS or LOGS — selects the row type inside the\ncursor, not which envelope field is set: `accountData`,\n`transactionData` or `logData` respectively. LOGS is a usable\nprepared-query target: `query.Execute` hydrates `logData` for it.) Both\npayloads use the same camelCase encoding as the equivalent non-prepared\nendpoints\n(header-negotiated monetary amounts, `color` always present on every volume row\nincluding the uncolored bucket).\n",
        "properties": [
          {
            "name": "cursor",
            "type": "object",
            "description": "Paged cursor, returned when the request `mode` is `LIST`. The row\ntype follows the query `target`: `accountData` for ACCOUNTS,\n`transactionData` for TRANSACTIONS, `logData` for LOGS. Rows use the\nsame camelCase shapes as the non-prepared list endpoints.\n",
            "inlineSchema": {
              "type": "object",
              "description": "Paged cursor, returned when the request `mode` is `LIST`. The row\ntype follows the query `target`: `accountData` for ACCOUNTS,\n`transactionData` for TRANSACTIONS, `logData` for LOGS. Rows use the\nsame camelCase shapes as the non-prepared list endpoints.\n",
              "properties": [
                {
                  "name": "pageSize",
                  "type": "integer (uint32)",
                  "description": "Effective LIST page size after applying the default and cap."
                },
                {
                  "name": "hasMore",
                  "type": "boolean",
                  "description": "True when a following page exists; set iff `next` is."
                },
                {
                  "name": "next",
                  "type": "ledgerV3_PageToken"
                },
                {
                  "name": "previous",
                  "type": "ledgerV3_PageToken"
                },
                {
                  "name": "accountData",
                  "type": "array of ledgerV3_Account"
                },
                {
                  "name": "transactionData",
                  "type": "array of ledgerV3_TransactionResponse"
                },
                {
                  "name": "logData",
                  "type": "array of ledgerV3_SystemLog"
                }
              ]
            }
          },
          {
            "name": "aggregateResult",
            "type": "ledgerV3_AggregateVolumesData"
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-addAccountType"></a>

### POST /api/ledger/v3/{ledgerName}/account-types

Add an account type

Adds a new account type to a ledger's chart of accounts. Account types define
address patterns for account validation. Requires `ledger:WriteMetadata` scope.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/account-types",
  "summary": "Add an account type",
  "description": "Adds a new account type to a ledger's chart of accounts. Account types define\naddress patterns for account validation. Requires `ledger:WriteMetadata` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Account Types",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_AddAccountTypeRequest",
      "properties": [
        {
          "name": "name",
          "type": "string",
          "description": "Unique name for the account type",
          "required": true,
          "example": "user-checking"
        },
        {
          "name": "pattern",
          "type": "string",
          "description": "Account address pattern for validation. Variables use `{name}` segments.",
          "required": true,
          "example": "users:{id}:checking"
        },
        {
          "name": "persistence",
          "type": "string",
          "description": "How account volumes are stored.\nNORMAL: fully persisted (default).\nEPHEMERAL: persisted, purged when zero balance after commit.\nTRANSIENT: never persisted, must be zero at end of batch.\n",
          "example": "EPHEMERAL",
          "enumValues": [
            "NORMAL",
            "EPHEMERAL",
            "TRANSIENT"
          ]
        },
        {
          "name": "segmentTypes",
          "type": "object",
          "description": "Maps a pattern variable name to a type constraint.",
          "example": {
            "id": {
              "type": "uuid"
            }
          }
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Account type added successfully"
    }
  ]
}
```

<a id="ledger-listAccountTypes"></a>

### GET /api/ledger/v3/{ledgerName}/account-types

List account types

Returns all account types defined on a ledger, sorted by name.
Requires `ledger:ReadAccount` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/account-types",
  "summary": "List account types",
  "description": "Returns all account types defined on a ledger, sorted by name.\nRequires `ledger:ReadAccount` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Account Types",
  "responses": [
    {
      "code": "200",
      "description": "Account types retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_ListAccountTypesResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "types",
                  "type": "array of ledgerV3_AccountTypeInfo",
                  "description": "List of account types sorted by name",
                  "required": true
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-setDefaultEnforcementMode"></a>

### PUT /api/ledger/v3/{ledgerName}/account-types/default-enforcement-mode

Set default enforcement mode

Sets the default enforcement mode for accounts that do not match any defined
account type. Must be STRICT or AUDIT. STRICT rejects an order that uses an
unmatched account with `400 ACCOUNT_NOT_MATCHING_TYPE`. AUDIT accepts the
order and does not report the unmatched account: the response carries no
warning. Requires `ledger:WriteMetadata` scope.

```json
{
  "method": "PUT",
  "path": "/api/ledger/v3/{ledgerName}/account-types/default-enforcement-mode",
  "summary": "Set default enforcement mode",
  "description": "Sets the default enforcement mode for accounts that do not match any defined\naccount type. Must be STRICT or AUDIT. STRICT rejects an order that uses an\nunmatched account with `400 ACCOUNT_NOT_MATCHING_TYPE`. AUDIT accepts the\norder and does not report the unmatched account: the response carries no\nwarning. Requires `ledger:WriteMetadata` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Account Types",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_SetDefaultEnforcementModeRequest",
      "properties": [
        {
          "name": "enforcementMode",
          "type": "string",
          "description": "Default enforcement mode for accounts not matching any account type",
          "required": true,
          "enumValues": [
            "STRICT",
            "AUDIT"
          ]
        }
      ]
    }
  },
  "responses": [
    {
      "code": "204",
      "description": "Default enforcement mode set successfully"
    }
  ]
}
```

<a id="ledger-getAccountType"></a>

### GET /api/ledger/v3/{ledgerName}/account-types/{typeName}

Get an account type

Retrieves a specific account type by name from a ledger. Requires `ledger:ReadAccount` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/account-types/{typeName}",
  "summary": "Get an account type",
  "description": "Retrieves a specific account type by name from a ledger. Requires `ledger:ReadAccount` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Account Types",
  "responses": [
    {
      "code": "200",
      "description": "Account type retrieved successfully",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_GetAccountTypeResponse",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_AccountTypeInfo",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-removeAccountType"></a>

### DELETE /api/ledger/v3/{ledgerName}/account-types/{typeName}

Remove an account type

Removes an account type from a ledger's chart of accounts. Requires `ledger:WriteMetadata` scope.

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}/account-types/{typeName}",
  "summary": "Remove an account type",
  "description": "Removes an account type from a ledger's chart of accounts. Requires `ledger:WriteMetadata` scope.",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Account Types",
  "responses": [
    {
      "code": "204",
      "description": "Account type removed successfully"
    }
  ]
}
```

<a id="ledger-getLog"></a>

### GET /api/ledger/v3/\_/logs/{sequence}

Get a single system log by bucket-wide sequence

Returns the system log entry with the given bucket-wide sequence number.
Requires `ledger:ReadOps` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/logs/{sequence}",
  "summary": "Get a single system log by bucket-wide sequence",
  "description": "Returns the system log entry with the given bucket-wide sequence number.\nRequires `ledger:ReadOps` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Logs",
  "pathParams": [
    {
      "name": "sequence",
      "description": ""
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Log retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "ledgerV3_SystemLog",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getEventsSinks"></a>

### GET /api/ledger/v3/\_/events-sinks

List configured event sinks

Returns every event sink configured on the cluster. Requires
`ledger:ReadOps` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/events-sinks",
  "summary": "List configured event sinks",
  "description": "Returns every event sink configured on the cluster. Requires\n`ledger:ReadOps` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Event Sinks",
  "responses": [
    {
      "code": "200",
      "description": "Event sinks retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "description": "Configured sinks together with their per-sink status, at parity with the gRPC GetEventsSinks response.\n",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "description": "Configured sinks together with their per-sink status, at parity with the gRPC GetEventsSinks response.\n",
              "properties": [
                {
                  "name": "sinks",
                  "type": "array of object"
                },
                {
                  "name": "sinkStatuses",
                  "type": "array of object"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-addEventsSink"></a>

### POST /api/ledger/v3/\_/events-sinks

Add an event sink

Adds a named event sink to the cluster. Requires `ledger:WriteOps` scope.
The body is a direct SinkConfig in protobuf JSON form, without a config
wrapper. A non-empty name and exactly one sink type are required.
Unknown fields, malformed protobuf JSON and multiple oneof members are
rejected with `INVALID_REQUEST`. Sink-specific connection settings and
credentials are not validated by business admission; successful creation
does not guarantee that the sink can connect or publish events.
`batchSize` above 100000 returns `SINK_BATCH_SIZE_TOO_LARGE` (400).
An existing name returns `SINK_ALREADY_EXISTS` (409).

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/_/events-sinks",
  "summary": "Add an event sink",
  "description": "Adds a named event sink to the cluster. Requires `ledger:WriteOps` scope.\nThe body is a direct SinkConfig in protobuf JSON form, without a config\nwrapper. A non-empty name and exactly one sink type are required.\nUnknown fields, malformed protobuf JSON and multiple oneof members are\nrejected with `INVALID_REQUEST`. Sink-specific connection settings and\ncredentials are not validated by business admission; successful creation\ndoes not guarantee that the sink can connect or publish events.\n`batchSize` above 100000 returns `SINK_BATCH_SIZE_TOO_LARGE` (400).\nAn existing name returns `SINK_ALREADY_EXISTS` (409).\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Event Sinks",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "ref": "ledgerV3_SinkConfig",
      "description": "Named sink configuration from common.SinkConfig, in protobuf JSON form.\nProperty names below use canonical lowerCamelCase; the decoder also\naccepts protobuf snake_case names. Exactly one sink type is required.\nConnection settings and credentials are stored without business validation.\nDefaults described below are applied by the event publisher.\n",
      "properties": [
        {
          "name": "name",
          "type": "string",
          "description": "Stable identifier for per-sink cursor and status keys",
          "required": true
        },
        {
          "name": "nats",
          "type": "ledgerV3_NatsSinkConfig"
        },
        {
          "name": "clickhouse",
          "type": "ledgerV3_ClickHouseSinkConfig"
        },
        {
          "name": "kafka",
          "type": "ledgerV3_KafkaSinkConfig"
        },
        {
          "name": "http",
          "type": "ledgerV3_HttpSinkConfig"
        },
        {
          "name": "databricks",
          "type": "ledgerV3_DatabricksSinkConfig"
        },
        {
          "name": "format",
          "type": "string",
          "description": "Event encoding, json or protobuf; defaults to json. Not validated at admission."
        },
        {
          "name": "batchSize",
          "type": "integer (int32)",
          "description": "Maximum events per batch; non-positive values use the publisher default of 64"
        },
        {
          "name": "batchDelayMs",
          "type": "oneOf",
          "description": "Maximum delay before flush in milliseconds; non-positive values use 10. Protobuf int64 JSON uses a decimal string; numeric input is also accepted.",
          "inlineSchema": {
            "type": "object",
            "description": "Maximum delay before flush in milliseconds; non-positive values use 10. Protobuf int64 JSON uses a decimal string; numeric input is also accepted.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          }
        },
        {
          "name": "eventTypes",
          "type": "array of ledgerV3_EventType",
          "description": "Event types to publish; omitted or empty means all events"
        },
        {
          "name": "controllerId",
          "type": "string",
          "description": "Opaque owner identity (EventSink CR UID); empty for manually managed sinks"
        }
      ],
      "oneOf": [
        {
          "type": "any"
        },
        {
          "type": "any"
        },
        {
          "type": "any"
        },
        {
          "type": "any"
        },
        {
          "type": "any"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Event sink created successfully. Only its name is returned.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "name",
                  "type": "string",
                  "required": true
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-removeEventsSink"></a>

### DELETE /api/ledger/v3/\_/events-sinks/{sinkName}

Remove an event sink

Removes a named event sink from the cluster. Requires `ledger:WriteOps`
scope. A non-empty controllerId must match the sink's controllerId;
a mismatch returns `SINK_CONTROLLER_MISMATCH` (409). An omitted or empty
controllerId removes the sink without an ownership precondition.
A missing sink returns `SINK_NOT_FOUND` (404). Malformed query encoding
or repeated controllerId parameters return `INVALID_REQUEST` (400)
before Apply, instead of becoming unconditional removal.

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/_/events-sinks/{sinkName}",
  "summary": "Remove an event sink",
  "description": "Removes a named event sink from the cluster. Requires `ledger:WriteOps`\nscope. A non-empty controllerId must match the sink's controllerId;\na mismatch returns `SINK_CONTROLLER_MISMATCH` (409). An omitted or empty\ncontrollerId removes the sink without an ownership precondition.\nA missing sink returns `SINK_NOT_FOUND` (404). Malformed query encoding\nor repeated controllerId parameters return `INVALID_REQUEST` (400)\nbefore Apply, instead of becoming unconditional removal.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Event Sinks",
  "pathParams": [
    {
      "name": "sinkName",
      "description": "Name of the event sink to remove"
    }
  ],
  "queryParams": [
    {
      "name": "controllerId",
      "description": "Optional opaque owner identity used as a removal precondition",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "204",
      "description": "Event sink removed successfully. No response body."
    }
  ]
}
```

<a id="ledger-listSigningKeys"></a>

### GET /api/ledger/v3/\_/signing-keys

List registered Ed25519 signing keys

Lists the Ed25519 signing keys registered on the cluster, paged by key
id (ascending unless `reverse=true`). Requires `ledger:ReadOps` scope.

This route performs a live read, linearizable by default.
`X-Consistency: stale` reads the receiving node's local state, which
may lag the leader. Signing-key reads are live-only on both transports.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/signing-keys",
  "summary": "List registered Ed25519 signing keys",
  "description": "Lists the Ed25519 signing keys registered on the cluster, paged by key\nid (ascending unless `reverse=true`). Requires `ledger:ReadOps` scope.\n\nThis route performs a live read, linearizable by default.\n`X-Consistency: stale` reads the receiving node's local state, which\nmay lag the leader. Signing-key reads are live-only on both transports.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Signing Keys",
  "queryParams": [
    {
      "name": "reverse",
      "description": "List in descending key id order when true.",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Signing keys retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "array of object",
            "required": true
          },
          {
            "name": "next",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "previous",
            "type": "ledgerV3_PageToken"
          },
          {
            "name": "hasMore",
            "type": "boolean",
            "description": "True when a following page exists; set iff `next` is.",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listBucketIndexes"></a>

### GET /api/ledger/v3/\_/indexes

List bucket-wide indexes

Streams the bucket-scoped index registry. The `scope` query parameter
selects the flavor: `all` (default, matches the ListIndexesRequest
proto default) streams every entry across ledgers, skipping orphan
entries whose owning ledger no longer exists; `bucket` surfaces only
bucket-scoped entries (empty ledger, e.g. audit indexes). Use
`GET /v3/{ledgerName}/indexes` for the per-ledger view. Requires
`ledger:ReadOps` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/indexes",
  "summary": "List bucket-wide indexes",
  "description": "Streams the bucket-scoped index registry. The `scope` query parameter\nselects the flavor: `all` (default, matches the ListIndexesRequest\nproto default) streams every entry across ledgers, skipping orphan\nentries whose owning ledger no longer exists; `bucket` surfaces only\nbucket-scoped entries (empty ledger, e.g. audit indexes). Use\n`GET /v3/{ledgerName}/indexes` for the per-ledger view. Requires\n`ledger:ReadOps` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "queryParams": [
    {
      "name": "scope",
      "description": "",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Indexes retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "array of object",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getBucketIndex"></a>

### GET /api/ledger/v3/\_/indexes/{canonicalId}

Get a single bucket-scoped index registry entry

Returns the `Index` registry entry for a bucket-scoped index
(`Ledger == ""`, e.g. audit indexes). Ledger-scoped lookups go
through `GET /v3/{ledgerName}/indexes/{canonicalId}` — the two
keyspaces are distinct so a bucket-scoped lookup with the same
canonical will NotFound if only the ledger-scoped entry exists.
Requires `ledger:ReadOps` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/indexes/{canonicalId}",
  "summary": "Get a single bucket-scoped index registry entry",
  "description": "Returns the `Index` registry entry for a bucket-scoped index\n(`Ledger == \"\"`, e.g. audit indexes). Ledger-scoped lookups go\nthrough `GET /v3/{ledgerName}/indexes/{canonicalId}` — the two\nkeyspaces are distinct so a bucket-scoped lookup with the same\ncanonical will NotFound if only the ledger-scoped entry exists.\nRequires `ledger:ReadOps` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "pathParams": [
    {
      "name": "canonicalId",
      "description": "Canonical form of the target IndexID."
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Index retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "description": "Index (protobuf JSON representation)",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getBucketIndexEntryStatus"></a>

### GET /api/ledger/v3/\_/indexes/{canonicalId}/status

Get the per-replica status of a single bucket-scoped index

Returns the `IndexEntry` (registry entry + backfill cursor +
per-replica IndexVersionState) for a bucket-scoped index.
Requires `ledger:ReadOps` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/indexes/{canonicalId}/status",
  "summary": "Get the per-replica status of a single bucket-scoped index",
  "description": "Returns the `IndexEntry` (registry entry + backfill cursor +\nper-replica IndexVersionState) for a bucket-scoped index.\nRequires `ledger:ReadOps` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "pathParams": [
    {
      "name": "canonicalId",
      "description": "Canonical form of the target IndexID."
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Index entry retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "description": "IndexEntry (protobuf JSON representation)",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getIndexStatus"></a>

### GET /api/ledger/v3/\_/indexes/status

Get aggregated index registry status

Returns the aggregated index registry status: per-index backfill cursor,
per-replica IndexVersionState (current/pending), and cluster-wide
counters (LastIndexedSequence, LastLogSequence, Lag, IndexFileSize).
The optional `ledger` query parameter narrows the per-index entries to
a single ledger; the aggregated counters always cover the bucket.
Requires `ledger:ReadOps` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/_/indexes/status",
  "summary": "Get aggregated index registry status",
  "description": "Returns the aggregated index registry status: per-index backfill cursor,\nper-replica IndexVersionState (current/pending), and cluster-wide\ncounters (LastIndexedSequence, LastLogSequence, Lag, IndexFileSize).\nThe optional `ledger` query parameter narrows the per-index entries to\na single ledger; the aggregated counters always cover the bucket.\nRequires `ledger:ReadOps` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "queryParams": [
    {
      "name": "ledger",
      "description": "",
      "required": false
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Index status retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "description": "GetIndexStatusResponse (protobuf JSON representation)",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-listLedgerIndexes"></a>

### GET /api/ledger/v3/{ledgerName}/indexes

List indexes for a ledger

Streams the indexes registered on a specific ledger. Requires
`ledger:ReadLedger` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/indexes",
  "summary": "List indexes for a ledger",
  "description": "Streams the indexes registered on a specific ledger. Requires\n`ledger:ReadLedger` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "responses": [
    {
      "code": "200",
      "description": "Indexes retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "array of object",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-createIndex"></a>

### POST /api/ledger/v3/{ledgerName}/indexes

Create an index on a ledger

Registers a new index on the ledger. An existing canonical index on
this ledger is rejected with `INDEX_ALREADY_EXISTS` (HTTP 409), even
while building or retyping, without changing its definition or progress.
Replaying an identical batch with its retained `Idempotency-Key` returns
the original result. The indexbuilder processes the accepted creation.
The request body carries the target `IndexID` in
canonical form (see `DELETE /v3/{ledgerName}/indexes/{canonicalId}`
for the format). Requires `ledger:WriteLedger` scope.

```json
{
  "method": "POST",
  "path": "/api/ledger/v3/{ledgerName}/indexes",
  "summary": "Create an index on a ledger",
  "description": "Registers a new index on the ledger. An existing canonical index on\nthis ledger is rejected with `INDEX_ALREADY_EXISTS` (HTTP 409), even\nwhile building or retyping, without changing its definition or progress.\nReplaying an identical batch with its retained `Idempotency-Key` returns\nthe original result. The indexbuilder processes the accepted creation.\nThe request body carries the target `IndexID` in\ncanonical form (see `DELETE /v3/{ledgerName}/indexes/{canonicalId}`\nfor the format). Requires `ledger:WriteLedger` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "schema": {
      "type": "object",
      "properties": [
        {
          "name": "id",
          "type": "string",
          "description": "Canonical form of the target IndexID. One of:\n  `tx_builtin:<TX_BUILTIN_INDEX_*>`\n  `log_builtin:<LOG_BUILTIN_INDEX_*>`\n  `account_builtin:<ACCT_BUILTIN_INDEX_*>`\n  `metadata:<TARGET_TYPE_*>:<key>`\n",
          "required": true,
          "example": "metadata:TARGET_TYPE_ACCOUNT:color"
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Index creation queued. The body carries the canonical id of the\ncreated index (round-trip normalized), usable directly on the\nfollow-up GET/DELETE `/v3/{ledgerName}/indexes/{canonicalId}` routes.\n",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "ledgerV3_CreateIndexResponse",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "id",
                  "type": "string",
                  "description": "Canonical form of the created IndexID (round-trip normalized),\ne.g. `metadata:TARGET_TYPE_ACCOUNT:color` or\n`tx_builtin:TX_BUILTIN_INDEX_TIMESTAMP`.\n",
                  "required": true,
                  "example": "metadata:TARGET_TYPE_ACCOUNT:color"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-getIndex"></a>

### GET /api/ledger/v3/{ledgerName}/indexes/{canonicalId}

Get a single index registry entry

Returns the `Index` registry entry (id, ledger, createdAt,
forwardEncodingVersion) for a single index, serialized in
protobuf-JSON camelCase. Requires `ledger:ReadLedger` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/indexes/{canonicalId}",
  "summary": "Get a single index registry entry",
  "description": "Returns the `Index` registry entry (id, ledger, createdAt,\nforwardEncodingVersion) for a single index, serialized in\nprotobuf-JSON camelCase. Requires `ledger:ReadLedger` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "pathParams": [
    {
      "name": "canonicalId",
      "description": "Canonical form of the target IndexID."
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Index retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "description": "Index (protobuf JSON representation)",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="ledger-dropIndex"></a>

### DELETE /api/ledger/v3/{ledgerName}/indexes/{canonicalId}

Drop an index from a ledger

Removes an index from a ledger. The path parameter carries the target
`IndexID` in canonical form (e.g. `metadata:TARGET_TYPE_ACCOUNT:color`,
`tx_builtin:TX_BUILTIN_INDEX_TIMESTAMP`). Requires `ledger:WriteLedger` scope.

The drop is idempotent. An `IndexID` that has no registry entry on the
ledger (never created, or already dropped) also answers `204`, and each
committed drop appends a `DROP_INDEX` entry to the ledger log. A
mistyped canonical id is therefore not reported; read the index with
`GET /v3/{ledgerName}/indexes/{canonicalId}` first when the caller must
know that it exists. `404` means that the ledger does not exist.

```json
{
  "method": "DELETE",
  "path": "/api/ledger/v3/{ledgerName}/indexes/{canonicalId}",
  "summary": "Drop an index from a ledger",
  "description": "Removes an index from a ledger. The path parameter carries the target\n`IndexID` in canonical form (e.g. `metadata:TARGET_TYPE_ACCOUNT:color`,\n`tx_builtin:TX_BUILTIN_INDEX_TIMESTAMP`). Requires `ledger:WriteLedger` scope.\n\nThe drop is idempotent. An `IndexID` that has no registry entry on the\nledger (never created, or already dropped) also answers `204`, and each\ncommitted drop appends a `DROP_INDEX` entry to the ledger log. A\nmistyped canonical id is therefore not reported; read the index with\n`GET /v3/{ledgerName}/indexes/{canonicalId}` first when the caller must\nknow that it exists. `404` means that the ledger does not exist.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "pathParams": [
    {
      "name": "canonicalId",
      "description": "Canonical form of the target IndexID."
    }
  ],
  "responses": [
    {
      "code": "204",
      "description": "Index removed, or no index with this id was registered on the ledger."
    }
  ]
}
```

<a id="ledger-getIndexEntryStatus"></a>

### GET /api/ledger/v3/{ledgerName}/indexes/{canonicalId}/status

Get the per-replica status of a single index

Returns the `IndexEntry` for a single index — the registry entry
joined with the backfill cursor and the per-replica
IndexVersionState (current + pending version). Use this to poll
for backfill completion after a `POST /v3/{ledgerName}/indexes`.
Requires `ledger:ReadLedger` scope.

```json
{
  "method": "GET",
  "path": "/api/ledger/v3/{ledgerName}/indexes/{canonicalId}/status",
  "summary": "Get the per-replica status of a single index",
  "description": "Returns the `IndexEntry` for a single index — the registry entry\njoined with the backfill cursor and the per-replica\nIndexVersionState (current + pending version). Use this to poll\nfor backfill completion after a `POST /v3/{ledgerName}/indexes`.\nRequires `ledger:ReadLedger` scope.\n",
  "tags": [
    "ledger.v3"
  ],
  "module": "Ledger",
  "resourceGroup": "Indexes",
  "pathParams": [
    {
      "name": "canonicalId",
      "description": "Canonical form of the target IndexID."
    }
  ],
  "responses": [
    {
      "code": "200",
      "description": "Index entry retrieved successfully.",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "properties": [
          {
            "name": "data",
            "type": "object",
            "description": "IndexEntry (protobuf JSON representation)",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-getQueryCapabilities"></a>

### GET /api/connectivity/\_query/capabilities

The filterable keys, operators and value enums per resource

Serialized from the same allowlist the server enforces on `?query=`,
so a UI can build its filter bar dynamically and never drift from
what the API accepts.

```json
{
  "method": "GET",
  "path": "/api/connectivity/_query/capabilities",
  "summary": "The filterable keys, operators and value enums per resource",
  "description": "Serialized from the same allowlist the server enforces on `?query=`,\nso a UI can build its filter bar dynamically and never drift from\nwhat the API accepts.\n",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Query Capabilities",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_QueryCapabilities",
        "description": "The filterable keys per resource, serialized from the same allowlist\nthe server enforces -- it cannot drift from what queries accept.\n",
        "properties": [
          {
            "name": "resources",
            "type": "object",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-listConnectors"></a>

### GET /api/connectivity/connectors

List published Connectors with their catalogue identity

Returns the published `Connector`s, each carrying the identity of its
newest Validated version (branding, tagline, tags, `latestVersion`) so
a catalogue UI renders and filters from this single request.

```json
{
  "method": "GET",
  "path": "/api/connectivity/connectors",
  "summary": "List published Connectors with their catalogue identity",
  "description": "Returns the published `Connector`s, each carrying the identity of its\nnewest Validated version (branding, tagline, tags, `latestVersion`) so\na catalogue UI renders and filters from this single request.\n",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connectors",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_ConnectorCursor",
        "properties": [
          {
            "name": "cursor",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "pageSize",
                  "type": "integer (int32)",
                  "required": true
                },
                {
                  "name": "hasMore",
                  "type": "boolean",
                  "required": true
                },
                {
                  "name": "next",
                  "type": "string",
                  "description": "Cursor of the next page; absent on the last page"
                },
                {
                  "name": "data",
                  "type": "array of connectivity_Connector",
                  "required": true
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-getConnectorFacets"></a>

### GET /api/connectivity/connectors/\_facets

Facet-value distribution over the published catalogue

Counts distinct published `Connector`s per `facet:value` tag (split on
the first `:`; flat tags carry no facet and are excluded), narrowed by
the same `query` filter as the list. `_facets` can never collide with
a connector: names are DNS labels, which cannot contain `_`.

```json
{
  "method": "GET",
  "path": "/api/connectivity/connectors/_facets",
  "summary": "Facet-value distribution over the published catalogue",
  "description": "Counts distinct published `Connector`s per `facet:value` tag (split on\nthe first `:`; flat tags carry no facet and are excluded), narrowed by\nthe same `query` filter as the list. `_facets` can never collide with\na connector: names are DNS labels, which cannot contain `_`.\n",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connectors",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_FacetDistribution",
        "description": "Distinct-connector counts per facet value, computed from the\nnamespaced `facet:value` tags of the connectors matching the query.\n",
        "properties": [
          {
            "name": "total",
            "type": "integer",
            "description": "Published connectors matching the query.",
            "required": true
          },
          {
            "name": "facets",
            "type": "object",
            "description": "Facet name to value-to-count map, e.g. `{\"provider\": {\"psp\": 6}}`.\n",
            "required": true
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-getConnector"></a>

### GET /api/connectivity/connectors/{name}

Get a Connector (lean connector metadata)

```json
{
  "method": "GET",
  "path": "/api/connectivity/connectors/{name}",
  "summary": "Get a Connector (lean connector metadata)",
  "description": "",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connectors",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_Connector",
        "description": "Read-only published connector information.",
        "properties": [
          {
            "name": "name",
            "type": "string",
            "required": true
          },
          {
            "name": "createdAt",
            "type": "string (date-time)"
          },
          {
            "name": "displayName",
            "type": "string",
            "description": "Human-readable name (e.g. `Adyen`)"
          },
          {
            "name": "description",
            "type": "string"
          },
          {
            "name": "catalog",
            "type": "string",
            "description": "Catalog (audience) this connector was discovered from; empty for hand-authored connectors"
          },
          {
            "name": "tags",
            "type": "array of string",
            "description": "`facet:value` tags (e.g. `provider:psp`, `domain:payouts`)\nprojected from the newest Validated version's marketing block.\nAbsent when the producer published none.\n"
          },
          {
            "name": "tagline",
            "type": "string",
            "description": "One-line marketing copy from the newest Validated version"
          },
          {
            "name": "branding",
            "type": "connectivity_ConnectorBranding"
          },
          {
            "name": "latestVersion",
            "type": "string",
            "description": "The newest Validated version (what `versions/latest` resolves to)"
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-listConnectorVersions"></a>

### GET /api/connectivity/connectors/{name}/versions

List the installable versions of a Connector

Returns the `ConnectorVersion`s published for this Connector, sorted
ascending by semantic version. Use `configuration.version` to pin a Connection,
or `configuration.channel` to track a maturity channel.

```json
{
  "method": "GET",
  "path": "/api/connectivity/connectors/{name}/versions",
  "summary": "List the installable versions of a Connector",
  "description": "Returns the `ConnectorVersion`s published for this Connector, sorted\nascending by semantic version. Use `configuration.version` to pin a Connection,\nor `configuration.channel` to track a maturity channel.\n",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connectors",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_ConnectorVersionCursor",
        "properties": [
          {
            "name": "cursor",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "pageSize",
                  "type": "integer (int32)",
                  "required": true
                },
                {
                  "name": "hasMore",
                  "type": "boolean",
                  "required": true
                },
                {
                  "name": "next",
                  "type": "string",
                  "description": "Cursor of the next page; absent on the last page"
                },
                {
                  "name": "data",
                  "type": "array of connectivity_ConnectorVersionSummary",
                  "description": "Versions sorted ascending by semantic version",
                  "required": true
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-getConnectorVersion"></a>

### GET /api/connectivity/connectors/{name}/versions/{version}

Get one Connector version (including its configSchema and additionalMetadata)

```json
{
  "method": "GET",
  "path": "/api/connectivity/connectors/{name}/versions/{version}",
  "summary": "Get one Connector version (including its configSchema and additionalMetadata)",
  "description": "",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connectors",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_ConnectorVersion",
        "properties": [
          {
            "name": "version",
            "type": "string",
            "description": "Version tag (e.g. `v1.4.2`)",
            "required": true
          },
          {
            "name": "digest",
            "type": "string",
            "description": "Image digest pinning this version immutably, when known"
          },
          {
            "name": "releaseDate",
            "type": "string (date-time)"
          },
          {
            "name": "configSchema",
            "type": "object",
            "description": "JSON Schema (draft 2020-12) describing the environment variables\nand files required to install this version. Consumed by the CLI /\nUI to render a form.\n"
          },
          {
            "name": "additionalMetadata",
            "type": "object",
            "description": "Free-form, schemaless metadata the connector's producer published in\nits manifest and the service does not interpret. Absent when the\nproducer supplied none.\n"
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-listConnections"></a>

### GET /api/connectivity/connections

List connector instances for this tenant

```json
{
  "method": "GET",
  "path": "/api/connectivity/connections",
  "summary": "List connector instances for this tenant",
  "description": "",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connections",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_ConnectionCursor",
        "properties": [
          {
            "name": "cursor",
            "type": "object",
            "required": true,
            "inlineSchema": {
              "type": "object",
              "properties": [
                {
                  "name": "pageSize",
                  "type": "integer (int32)",
                  "required": true
                },
                {
                  "name": "hasMore",
                  "type": "boolean",
                  "required": true
                },
                {
                  "name": "next",
                  "type": "string",
                  "description": "Cursor of the next page; absent on the last page"
                },
                {
                  "name": "data",
                  "type": "array of connectivity_Connection",
                  "required": true
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-createConnection"></a>

### POST /api/connectivity/connections

Create a Connection

Creates a new `Connection` in the caller's environment.
`configuration.connector`, `configuration.ledger` and exactly one of `configuration.version` or
`configuration.channel` are required. `env` and `files` are string key/value maps;
properties marked `format: password` by the selected connector schema
are stored confidentially and omitted from read responses.
Storage metadata and configuration references are rejected on input.
A field outside the tenant contract,
including unsupported instance fields such as `image`, `additionalEnv`,
`additionalFiles` or `replicas`, is rejected with
`400 unsupported_field`.

```json
{
  "method": "POST",
  "path": "/api/connectivity/connections",
  "summary": "Create a Connection",
  "description": "Creates a new `Connection` in the caller's environment.\n`configuration.connector`, `configuration.ledger` and exactly one of `configuration.version` or\n`configuration.channel` are required. `env` and `files` are string key/value maps;\nproperties marked `format: password` by the selected connector schema\nare stored confidentially and omitted from read responses.\nStorage metadata and configuration references are rejected on input.\nA field outside the tenant contract,\nincluding unsupported instance fields such as `image`, `additionalEnv`,\n`additionalFiles` or `replicas`, is rejected with\n`400 unsupported_field`.\n",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connections",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "description": "Encoded request body must not exceed 1 MiB (1,048,576 bytes).",
    "schema": {
      "type": "object",
      "ref": "connectivity_ConnectionCreate",
      "properties": [
        {
          "name": "name",
          "type": "string",
          "required": true
        },
        {
          "name": "configuration",
          "type": "any",
          "required": true
        }
      ]
    }
  },
  "responses": [
    {
      "code": "201",
      "description": "Created",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_Connection",
        "properties": [
          {
            "name": "name",
            "type": "string",
            "description": "Instance name.",
            "required": true
          },
          {
            "name": "configuration",
            "type": "connectivity_ConnectionConfiguration",
            "required": true
          },
          {
            "name": "status",
            "type": "connectivity_ConnectionStatus"
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-getConnection"></a>

### GET /api/connectivity/connections/{name}

Get a Connection

```json
{
  "method": "GET",
  "path": "/api/connectivity/connections/{name}",
  "summary": "Get a Connection",
  "description": "",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connections",
  "responses": [
    {
      "code": "200",
      "description": "OK",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_Connection",
        "properties": [
          {
            "name": "name",
            "type": "string",
            "description": "Instance name.",
            "required": true
          },
          {
            "name": "configuration",
            "type": "connectivity_ConnectionConfiguration",
            "required": true
          },
          {
            "name": "status",
            "type": "connectivity_ConnectionStatus"
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-replaceConnection"></a>

### PUT /api/connectivity/connections/{name}

Replace a connector instance configuration

Full-replace semantics on mutable tenant `configuration`: omitted mutable
fields are cleared. The API does not write fields outside its tenant scope.
`status` is preserved. `connector` and `ledger` are immutable once set:
omission preserves them, first assignment and unchanged values are accepted,
and changes or null return `422 connector_immutable` or `422 ledger_immutable`. Read responses omit reference-backed entries,
so PUT must supply the complete configuration, including required secrets.
Use PATCH to preserve omitted configuration. Fields outside the tenant contract are rejected with
`400 unsupported_field`.

```json
{
  "method": "PUT",
  "path": "/api/connectivity/connections/{name}",
  "summary": "Replace a connector instance configuration",
  "description": "Full-replace semantics on mutable tenant `configuration`: omitted mutable\nfields are cleared. The API does not write fields outside its tenant scope.\n`status` is preserved. `connector` and `ledger` are immutable once set:\nomission preserves them, first assignment and unchanged values are accepted,\nand changes or null return `422 connector_immutable` or `422 ledger_immutable`. Read responses omit reference-backed entries,\nso PUT must supply the complete configuration, including required secrets.\nUse PATCH to preserve omitted configuration. Fields outside the tenant contract are rejected with\n`400 unsupported_field`.\n",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connections",
  "requestBody": {
    "mediaType": "application/json",
    "required": true,
    "description": "Encoded request body must not exceed 1 MiB (1,048,576 bytes).",
    "schema": {
      "type": "object",
      "ref": "connectivity_ConnectionUpdate",
      "properties": [
        {
          "name": "configuration",
          "type": "connectivity_ConnectionConfiguration",
          "required": true
        }
      ]
    }
  },
  "responses": [
    {
      "code": "200",
      "description": "Updated",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_Connection",
        "properties": [
          {
            "name": "name",
            "type": "string",
            "description": "Instance name.",
            "required": true
          },
          {
            "name": "configuration",
            "type": "connectivity_ConnectionConfiguration",
            "required": true
          },
          {
            "name": "status",
            "type": "connectivity_ConnectionStatus"
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-patchConnection"></a>

### PATCH /api/connectivity/connections/{name}

Merge-patch a connector instance configuration

JSON merge patch (RFC 7396) over tenant `configuration` fields only. Other fields
are rejected with `400 unsupported_field`. `env` and `files` are string
maps: omitted entries are preserved, including secret-backed values;
`null` deletes a field or map entry. A supplied literal replaces the
stored source. `connector` and `ledger` are not PATCH fields: any presence, including
unchanged values and null, returns `400 unsupported_field`. The merged
result must retain exactly one of `version` and `channel`, so
switching selectors sends `null` for the other one.

```json
{
  "method": "PATCH",
  "path": "/api/connectivity/connections/{name}",
  "summary": "Merge-patch a connector instance configuration",
  "description": "JSON merge patch (RFC 7396) over tenant `configuration` fields only. Other fields\nare rejected with `400 unsupported_field`. `env` and `files` are string\nmaps: omitted entries are preserved, including secret-backed values;\n`null` deletes a field or map entry. A supplied literal replaces the\nstored source. `connector` and `ledger` are not PATCH fields: any presence, including\nunchanged values and null, returns `400 unsupported_field`. The merged\nresult must retain exactly one of `version` and `channel`, so\nswitching selectors sends `null` for the other one.\n",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connections",
  "responses": [
    {
      "code": "200",
      "description": "Patched",
      "mediaType": "application/json",
      "schema": {
        "type": "object",
        "ref": "connectivity_Connection",
        "properties": [
          {
            "name": "name",
            "type": "string",
            "description": "Instance name.",
            "required": true
          },
          {
            "name": "configuration",
            "type": "connectivity_ConnectionConfiguration",
            "required": true
          },
          {
            "name": "status",
            "type": "connectivity_ConnectionStatus"
          }
        ]
      }
    }
  ]
}
```

<a id="connectivity-deleteConnection"></a>

### DELETE /api/connectivity/connections/{name}

Delete a Connection

```json
{
  "method": "DELETE",
  "path": "/api/connectivity/connections/{name}",
  "summary": "Delete a Connection",
  "description": "",
  "tags": [
    "connectivity.v1"
  ],
  "module": "Connectivity",
  "resourceGroup": "Connections",
  "responses": [
    {
      "code": "204",
      "description": "Deleted"
    }
  ]
}
```
