# party.whey.writeproxy.defs

> Shared shapes for the write delegation proxy control plane. The NSID authority is a placeholder.

- Kind: defs
- Authority: writeproxy.whey.party
- Lexicon: 1
- Published by [whey.party](https://lexicon.garden/identity/did:plc:mn45tewwnse5btfftvd3powc), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.writeproxy.defs)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.writeproxy.defs/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mn45tewwnse5btfftvd3powc/party.whey.writeproxy.defs/analytics)

## #auditEntry (`party.whey.writeproxy.defs#auditEntry`)

Type: object

### Properties

- `actor` (string · did, required)
- `caller` (string · did)
- `delegation` (string)
  - Constraints: maxLength: 128
- `error` (string)
  - Constraints: maxLength: 128
- `event` (string, required)
  - Constraints: maxLength: 64
- `id` (integer, required)
  - Constraints: minimum: 0
- `reason` (string)
  - Constraints: maxLength: 256
- `role` (string, required)
  - Constraints: enum: delegator | caller | operator | system | legacy
- `space` (string · space-ref)
- `status` (integer, required)
  - Constraints: minimum: 100, maximum: 599
- `ts` (string · datetime, required)
- `via` (string)
  - Constraints: enum: xrpc | rest

## #blobPolicy (`party.whey.writeproxy.defs#blobPolicy`)

Type: object

The delegation's blob upload policy.

### Properties

- `accept` (array): Allowed MIME types or globs. Omit to use the profile/service default.
  - Constraints: maxLength: 20
  - `items` (string)
    - Constraints: maxLength: 255
- `allowed` (boolean, required)
- `maxBytes` (integer): Maximum bytes per blob for this delegation.
  - Constraints: minimum: 1

## #blocklistEntry (`party.whey.writeproxy.defs#blocklistEntry`)

Type: object

### Properties

- `createdAt` (string · datetime, required)
- `createdBy` (string · did)
- `expiresAt` (string · datetime)
- `kind` (string, required)
  - Constraints: enum: did | pds | ip | cidr | asn | domain | nsid
- `reason` (string)
  - Constraints: maxLength: 256
- `value` (string, required)
  - Constraints: maxLength: 512

## #callerDelegation (`party.whey.writeproxy.defs#callerDelegation`)

Type: object

A delegation as seen by an authorized caller, with effective limits.

### Properties

- `actions` (array, required)
  - Constraints: minLength: 1
  - `items` (string)
    - Constraints: enum: create | update | delete
- `blob` (ref)
  - Reference: `#blobPolicy`
- `collections` (array, required)
  - Constraints: minLength: 1
  - `items` (string · nsid)
- `delegation` (string, required)
  - Constraints: maxLength: 128
- `limits` (ref)
  - Reference: `#limits`
- `remaining` (ref)
  - Reference: `#remaining`
- `repoDID` (string · did, required)
- `resetAt` (string · datetime)
- `space` (string · space-ref, required)
- `usage` (ref)
  - Reference: `#usage`

## #callerRegistration (`party.whey.writeproxy.defs#callerRegistration`)

Type: object

### Properties

- `allowlistCount` (integer)
  - Constraints: minimum: 0
- `mode` (string, required)
  - Constraints: enum: none | open | approval | allowlist | closed

## #callerRequest (`party.whey.writeproxy.defs#callerRequest`)

Type: object

### Properties

- `caller` (string · did, required)
- `createdAt` (string · datetime, required)
- `delegation` (string, required)
  - Constraints: maxLength: 128
- `id` (string, required)
  - Constraints: maxLength: 128
- `message` (string)
  - Constraints: maxLength: 1000
- `resolvedAt` (string · datetime)
- `resolvedBy` (string · did)
- `status` (string, required)
  - Constraints: enum: pending | approved | rejected

## #counts (`party.whey.writeproxy.defs#counts`)

Type: object

### Properties

- `activeDelegations` (integer)
  - Constraints: minimum: 0
- `blocked` (integer)
  - Constraints: minimum: 0
- `callers` (integer)
  - Constraints: minimum: 0
- `delegations` (integer)
  - Constraints: minimum: 0
- `pendingRequests` (integer)
  - Constraints: minimum: 0
- `registrations` (integer)
  - Constraints: minimum: 0

## #credentialHealth (`party.whey.writeproxy.defs#credentialHealth`)

Type: object

### Properties

- `delegation` (string, required)
  - Constraints: maxLength: 128
- `expiresAt` (string · datetime)
- `lastError` (string)
  - Constraints: maxLength: 256
- `lastRefreshAt` (string · datetime)
- `mode` (string)
  - Constraints: enum: oauth
- `pdsUrl` (string · uri)
- `refreshState` (string, required)
  - Constraints: enum: pending | ok | refreshing | failed
- `repoDID` (string · did, required)
- `space` (string · space-ref)

## #credentialStatus (`party.whey.writeproxy.defs#credentialStatus`)

Type: object

Credential health for a delegation. Never contains tokens or DPoP keys.

### Properties

- `expiresAt` (string · datetime)
- `lastError` (string)
  - Constraints: maxLength: 256
- `lastRefreshAt` (string · datetime)
- `mode` (string, required)
  - Constraints: enum: oauth
- `pdsUrl` (string · uri)
- `refreshState` (string, required)
  - Constraints: enum: pending | ok | refreshing | failed

## #delegation (`party.whey.writeproxy.defs#delegation`)

Type: object

One write delegation. It binds exactly one (space, repo) pair and has an immutable scope.

### Properties

- `actions` (array, required)
  - Constraints: minLength: 1, maxLength: 3
  - `items` (string)
    - Constraints: enum: create | update | delete
- `activatedAt` (string · datetime)
- `blob` (ref)
  - Reference: `#blobPolicy`
- `callerCount` (integer, required)
  - Constraints: minimum: 0
- `callerRevision` (integer, required): Compare-and-swap token for the caller allowlist.
  - Constraints: minimum: 0
- `collections` (array, required)
  - Constraints: minLength: 1, maxLength: 100
  - `items` (string · nsid)
- `createdAt` (string · datetime, required)
- `id` (string, required)
  - Constraints: maxLength: 128
- `label` (string)
  - Constraints: maxLength: 128
- `repoDID` (string · did, required): The repo owner and OAuth subject. Equal to the delegator DID.
- `returnTo` (string · uri)
  - Constraints: maxLength: 2048
- `revision` (integer, required): Compare-and-swap token for delegation metadata.
  - Constraints: minimum: 0
- `revokedAt` (string · datetime)
- `skey` (string · record-key, required)
- `space` (string · space-ref, required)
- `spaceAuthority` (string · did, required)
- `spaceType` (string · nsid, required)
- `status` (string, required)
  - Constraints: enum: pending | active | degraded | suspended | revoked | expired
- `updatedAt` (string · datetime, required)

## #delegatorOnboarding (`party.whey.writeproxy.defs#delegatorOnboarding`)

Type: object

### Properties

- `allowlistCount` (integer)
  - Constraints: minimum: 0
- `mode` (string, required)
  - Constraints: enum: open | approval | allowlist | closed | disabled

## #limits (`party.whey.writeproxy.defs#limits`)

Type: object

Effective limits for a service, caller, or delegation scope. Values are integers; units are in the property name or description.

### Properties

- `auditRetentionDays` (integer)
  - Constraints: minimum: 0
- `controlPerMinute` (integer)
  - Constraints: minimum: 0
- `idempotencyTtlSeconds` (integer)
  - Constraints: minimum: 0
- `maxBatchWrites` (integer)
  - Constraints: minimum: 1
- `maxBlobBytes` (integer)
  - Constraints: minimum: 1
- `maxBlobUploadsPerDay` (integer)
  - Constraints: minimum: 0
- `maxBodyBytes` (integer)
  - Constraints: minimum: 1
- `maxCallersPerDelegation` (integer)
  - Constraints: minimum: 0
- `maxDelegationsPerRepo` (integer)
  - Constraints: minimum: 0
- `maxRecordBytes` (integer)
  - Constraints: minimum: 1
- `oauthStartsPerHour` (integer)
  - Constraints: minimum: 0
- `rateLimitWindowSeconds` (integer)
  - Constraints: minimum: 1
- `writesPerDay` (integer)
  - Constraints: minimum: 0
- `writesPerMinute` (integer)
  - Constraints: minimum: 0

## #limitsView (`party.whey.writeproxy.defs#limitsView`)

Type: object

### Properties

- `limits` (ref, required)
  - Reference: `#limits`
- `remaining` (ref)
  - Reference: `#remaining`
- `resetAt` (string · datetime)
- `scope` (string, required)
  - Constraints: enum: service | caller | delegation
- `usage` (ref)
  - Reference: `#usage`

## #oauthClientMetadata (`party.whey.writeproxy.defs#oauthClientMetadata`)

Type: object

### Properties

- `baseUrl` (string · uri)
- `jwksUrl` (string · uri)
- `mode` (string, required): v0 MUST use per-delegation. shared is reserved for a post-v0 revision.
  - Constraints: enum: per-delegation | shared
- `sharedClientId` (string · uri): Only for mode=shared; not used in v0.
- `template` (string): Template for the per-delegation client metadata URL. The {delegation} placeholder is replaced with the delegation ID.
  - Constraints: maxLength: 512

## #queue (`party.whey.writeproxy.defs#queue`)

Type: object

### Properties

- `pending` (integer)
  - Constraints: minimum: 0
- `spaces` (integer)
  - Constraints: minimum: 0

## #quotas (`party.whey.writeproxy.defs#quotas`)

Type: object

### Properties

- `blobsPerDay` (integer)
  - Constraints: minimum: 0
- `bytesPerDay` (integer)
  - Constraints: minimum: 0
- `concurrent` (integer)
  - Constraints: minimum: 0
- `writesPerDay` (integer)
  - Constraints: minimum: 0

## #registration (`party.whey.writeproxy.defs#registration`)

Type: object

### Properties

- `approvedAt` (string · datetime)
- `approvedBy` (string · did)
- `createdAt` (string · datetime, required)
- `did` (string · did, required)
- `handle` (string)
  - Constraints: maxLength: 253
- `pdsUrl` (string · uri)
- `quotas` (ref)
  - Reference: `#quotas`
- `reason` (string)
  - Constraints: maxLength: 256
- `role` (string, required)
  - Constraints: enum: delegator | caller
- `status` (string, required)
  - Constraints: enum: pending | approved | rejected | suspended
- `trustLevel` (string)
  - Constraints: maxLength: 64

## #remaining (`party.whey.writeproxy.defs#remaining`)

Type: object

Remaining counters for a caller or delegation in the current window.

### Properties

- `blobsToday` (integer)
  - Constraints: minimum: 0
- `bytesToday` (integer)
  - Constraints: minimum: 0
- `writesThisMinute` (integer)
  - Constraints: minimum: 0
- `writesToday` (integer)
  - Constraints: minimum: 0

## #serviceMode (`party.whey.writeproxy.defs#serviceMode`)

Type: object

### Properties

- `callerRegistration` (ref, required)
  - Reference: `#callerRegistration`
- `delegatorOnboarding` (ref, required)
  - Reference: `#delegatorOnboarding`
- `writesEnabled` (boolean, required)

## #serviceStatus (`party.whey.writeproxy.defs#serviceStatus`)

Type: object

### Properties

- `callerRegistration` (ref, required)
  - Reference: `#callerRegistration`
- `counts` (ref, required)
  - Reference: `#counts`
- `delegatorOnboarding` (ref, required)
  - Reference: `#delegatorOnboarding`
- `did` (string · did, required)
- `endpoint` (string · uri, required)
- `limits` (ref, required)
  - Reference: `#limits`
- `queue` (ref)
  - Reference: `#queue`
- `service` (string, required)
  - Constraints: maxLength: 128
- `updatedAt` (string · datetime, required)
- `uptimeMs` (integer, required)
  - Constraints: minimum: 0
- `version` (string, required)
  - Constraints: maxLength: 64
- `writesEnabled` (boolean)

## #usage (`party.whey.writeproxy.defs#usage`)

Type: object

Usage counters for a caller or delegation in the current window.

### Properties

- `blobsToday` (integer)
  - Constraints: minimum: 0
- `bytesToday` (integer)
  - Constraints: minimum: 0
- `writesThisMinute` (integer)
  - Constraints: minimum: 0
- `writesToday` (integer)
  - Constraints: minimum: 0

## #writeAudit (`party.whey.writeproxy.defs#writeAudit`)

Type: object

### Properties

- `action` (string, required)
  - Constraints: enum: create | update | delete
- `caller` (string · did, required)
- `cid` (string)
  - Constraints: maxLength: 128
- `collection` (string · nsid)
- `error` (string)
  - Constraints: maxLength: 128
- `id` (integer, required)
  - Constraints: minimum: 0
- `latencyMs` (integer)
  - Constraints: minimum: 0
- `rkey` (string · record-key)
- `size` (integer)
  - Constraints: minimum: 0
- `status` (integer, required)
  - Constraints: minimum: 100, maximum: 599
- `ts` (string · datetime, required)

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "auditEntry": {
      "properties": {
        "actor": {
          "format": "did",
          "type": "string"
        },
        "caller": {
          "format": "did",
          "type": "string"
        },
        "delegation": {
          "maxLength": 128,
          "type": "string"
        },
        "error": {
          "maxLength": 128,
          "type": "string"
        },
        "event": {
          "maxLength": 64,
          "type": "string"
        },
        "id": {
          "minimum": 0,
          "type": "integer"
        },
        "reason": {
          "maxLength": 256,
          "type": "string"
        },
        "role": {
          "enum": [
            "delegator",
            "caller",
            "operator",
            "system",
            "legacy"
          ],
          "type": "string"
        },
        "space": {
          "format": "space-ref",
          "type": "string"
        },
        "status": {
          "maximum": 599,
          "minimum": 100,
          "type": "integer"
        },
        "ts": {
          "format": "datetime",
          "type": "string"
        },
        "via": {
          "enum": [
            "xrpc",
            "rest"
          ],
          "type": "string"
        }
      },
      "required": [
        "id",
        "ts",
        "actor",
        "role",
        "event",
        "status"
      ],
      "type": "object"
    },
    "blobPolicy": {
      "description": "The delegation's blob upload policy.",
      "properties": {
        "accept": {
          "description": "Allowed MIME types or globs. Omit to use the profile/service default.",
          "items": {
            "maxLength": 255,
            "type": "string"
          },
          "maxLength": 20,
          "type": "array"
        },
        "allowed": {
          "type": "boolean"
        },
        "maxBytes": {
          "description": "Maximum bytes per blob for this delegation.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "allowed"
      ],
      "type": "object"
    },
    "blocklistEntry": {
      "properties": {
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "createdBy": {
          "format": "did",
          "type": "string"
        },
        "expiresAt": {
          "format": "datetime",
          "type": "string"
        },
        "kind": {
          "enum": [
            "did",
            "pds",
            "ip",
            "cidr",
            "asn",
            "domain",
            "nsid"
          ],
          "type": "string"
        },
        "reason": {
          "maxLength": 256,
          "type": "string"
        },
        "value": {
          "maxLength": 512,
          "type": "string"
        }
      },
      "required": [
        "kind",
        "value",
        "createdAt"
      ],
      "type": "object"
    },
    "callerDelegation": {
      "description": "A delegation as seen by an authorized caller, with effective limits.",
      "properties": {
        "actions": {
          "items": {
            "enum": [
              "create",
              "update",
              "delete"
            ],
            "type": "string"
          },
          "minLength": 1,
          "type": "array"
        },
        "blob": {
          "ref": "#blobPolicy",
          "type": "ref"
        },
        "collections": {
          "items": {
            "format": "nsid",
            "type": "string"
          },
          "minLength": 1,
          "type": "array"
        },
        "delegation": {
          "maxLength": 128,
          "type": "string"
        },
        "limits": {
          "ref": "#limits",
          "type": "ref"
        },
        "remaining": {
          "ref": "#remaining",
          "type": "ref"
        },
        "repoDID": {
          "format": "did",
          "type": "string"
        },
        "resetAt": {
          "format": "datetime",
          "type": "string"
        },
        "space": {
          "format": "space-ref",
          "type": "string"
        },
        "usage": {
          "ref": "#usage",
          "type": "ref"
        }
      },
      "required": [
        "delegation",
        "space",
        "repoDID",
        "collections",
        "actions"
      ],
      "type": "object"
    },
    "callerRegistration": {
      "properties": {
        "allowlistCount": {
          "minimum": 0,
          "type": "integer"
        },
        "mode": {
          "enum": [
            "none",
            "open",
            "approval",
            "allowlist",
            "closed"
          ],
          "type": "string"
        }
      },
      "required": [
        "mode"
      ],
      "type": "object"
    },
    "callerRequest": {
      "properties": {
        "caller": {
          "format": "did",
          "type": "string"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "delegation": {
          "maxLength": 128,
          "type": "string"
        },
        "id": {
          "maxLength": 128,
          "type": "string"
        },
        "message": {
          "maxLength": 1000,
          "type": "string"
        },
        "resolvedAt": {
          "format": "datetime",
          "type": "string"
        },
        "resolvedBy": {
          "format": "did",
          "type": "string"
        },
        "status": {
          "enum": [
            "pending",
            "approved",
            "rejected"
          ],
          "type": "string"
        }
      },
      "required": [
        "id",
        "delegation",
        "caller",
        "status",
        "createdAt"
      ],
      "type": "object"
    },
    "counts": {
      "properties": {
        "activeDelegations": {
          "minimum": 0,
          "type": "integer"
        },
        "blocked": {
          "minimum": 0,
          "type": "integer"
        },
        "callers": {
          "minimum": 0,
          "type": "integer"
        },
        "delegations": {
          "minimum": 0,
          "type": "integer"
        },
        "pendingRequests": {
          "minimum": 0,
          "type": "integer"
        },
        "registrations": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "credentialHealth": {
      "properties": {
        "delegation": {
          "maxLength": 128,
          "type": "string"
        },
        "expiresAt": {
          "format": "datetime",
          "type": "string"
        },
        "lastError": {
          "maxLength": 256,
          "type": "string"
        },
        "lastRefreshAt": {
          "format": "datetime",
          "type": "string"
        },
        "mode": {
          "enum": [
            "oauth"
          ],
          "type": "string"
        },
        "pdsUrl": {
          "format": "uri",
          "type": "string"
        },
        "refreshState": {
          "enum": [
            "pending",
            "ok",
            "refreshing",
            "failed"
          ],
          "type": "string"
        },
        "repoDID": {
          "format": "did",
          "type": "string"
        },
        "space": {
          "format": "space-ref",
          "type": "string"
        }
      },
      "required": [
        "delegation",
        "repoDID",
        "refreshState"
      ],
      "type": "object"
    },
    "credentialStatus": {
      "description": "Credential health for a delegation. Never contains tokens or DPoP keys.",
      "properties": {
        "expiresAt": {
          "format": "datetime",
          "type": "string"
        },
        "lastError": {
          "maxLength": 256,
          "type": "string"
        },
        "lastRefreshAt": {
          "format": "datetime",
          "type": "string"
        },
        "mode": {
          "enum": [
            "oauth"
          ],
          "type": "string"
        },
        "pdsUrl": {
          "format": "uri",
          "type": "string"
        },
        "refreshState": {
          "enum": [
            "pending",
            "ok",
            "refreshing",
            "failed"
          ],
          "type": "string"
        }
      },
      "required": [
        "mode",
        "refreshState"
      ],
      "type": "object"
    },
    "delegation": {
      "description": "One write delegation. It binds exactly one (space, repo) pair and has an immutable scope.",
      "properties": {
        "actions": {
          "items": {
            "enum": [
              "create",
              "update",
              "delete"
            ],
            "type": "string"
          },
          "maxLength": 3,
          "minLength": 1,
          "type": "array"
        },
        "activatedAt": {
          "format": "datetime",
          "type": "string"
        },
        "blob": {
          "ref": "#blobPolicy",
          "type": "ref"
        },
        "callerCount": {
          "minimum": 0,
          "type": "integer"
        },
        "callerRevision": {
          "description": "Compare-and-swap token for the caller allowlist.",
          "minimum": 0,
          "type": "integer"
        },
        "collections": {
          "items": {
            "format": "nsid",
            "type": "string"
          },
          "maxLength": 100,
          "minLength": 1,
          "type": "array"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "id": {
          "maxLength": 128,
          "type": "string"
        },
        "label": {
          "maxLength": 128,
          "type": "string"
        },
        "repoDID": {
          "description": "The repo owner and OAuth subject. Equal to the delegator DID.",
          "format": "did",
          "type": "string"
        },
        "returnTo": {
          "format": "uri",
          "maxLength": 2048,
          "type": "string"
        },
        "revision": {
          "description": "Compare-and-swap token for delegation metadata.",
          "minimum": 0,
          "type": "integer"
        },
        "revokedAt": {
          "format": "datetime",
          "type": "string"
        },
        "skey": {
          "format": "record-key",
          "type": "string"
        },
        "space": {
          "format": "space-ref",
          "type": "string"
        },
        "spaceAuthority": {
          "format": "did",
          "type": "string"
        },
        "spaceType": {
          "format": "nsid",
          "type": "string"
        },
        "status": {
          "enum": [
            "pending",
            "active",
            "degraded",
            "suspended",
            "revoked",
            "expired"
          ],
          "type": "string"
        },
        "updatedAt": {
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "id",
        "status",
        "space",
        "spaceAuthority",
        "spaceType",
        "skey",
        "repoDID",
        "collections",
        "actions",
        "callerCount",
        "callerRevision",
        "revision",
        "createdAt",
        "updatedAt"
      ],
      "type": "object"
    },
    "delegatorOnboarding": {
      "properties": {
        "allowlistCount": {
          "minimum": 0,
          "type": "integer"
        },
        "mode": {
          "enum": [
            "open",
            "approval",
            "allowlist",
            "closed",
            "disabled"
          ],
          "type": "string"
        }
      },
      "required": [
        "mode"
      ],
      "type": "object"
    },
    "limits": {
      "description": "Effective limits for a service, caller, or delegation scope. Values are integers; units are in the property name or description.",
      "properties": {
        "auditRetentionDays": {
          "minimum": 0,
          "type": "integer"
        },
        "controlPerMinute": {
          "minimum": 0,
          "type": "integer"
        },
        "idempotencyTtlSeconds": {
          "minimum": 0,
          "type": "integer"
        },
        "maxBatchWrites": {
          "minimum": 1,
          "type": "integer"
        },
        "maxBlobBytes": {
          "minimum": 1,
          "type": "integer"
        },
        "maxBlobUploadsPerDay": {
          "minimum": 0,
          "type": "integer"
        },
        "maxBodyBytes": {
          "minimum": 1,
          "type": "integer"
        },
        "maxCallersPerDelegation": {
          "minimum": 0,
          "type": "integer"
        },
        "maxDelegationsPerRepo": {
          "minimum": 0,
          "type": "integer"
        },
        "maxRecordBytes": {
          "minimum": 1,
          "type": "integer"
        },
        "oauthStartsPerHour": {
          "minimum": 0,
          "type": "integer"
        },
        "rateLimitWindowSeconds": {
          "minimum": 1,
          "type": "integer"
        },
        "writesPerDay": {
          "minimum": 0,
          "type": "integer"
        },
        "writesPerMinute": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "limitsView": {
      "properties": {
        "limits": {
          "ref": "#limits",
          "type": "ref"
        },
        "remaining": {
          "ref": "#remaining",
          "type": "ref"
        },
        "resetAt": {
          "format": "datetime",
          "type": "string"
        },
        "scope": {
          "enum": [
            "service",
            "caller",
            "delegation"
          ],
          "type": "string"
        },
        "usage": {
          "ref": "#usage",
          "type": "ref"
        }
      },
      "required": [
        "scope",
        "limits"
      ],
      "type": "object"
    },
    "oauthClientMetadata": {
      "properties": {
        "baseUrl": {
          "format": "uri",
          "type": "string"
        },
        "jwksUrl": {
          "format": "uri",
          "type": "string"
        },
        "mode": {
          "description": "v0 MUST use per-delegation. shared is reserved for a post-v0 revision.",
          "enum": [
            "per-delegation",
            "shared"
          ],
          "type": "string"
        },
        "sharedClientId": {
          "description": "Only for mode=shared; not used in v0.",
          "format": "uri",
          "type": "string"
        },
        "template": {
          "description": "Template for the per-delegation client metadata URL. The {delegation} placeholder is replaced with the delegation ID.",
          "maxLength": 512,
          "type": "string"
        }
      },
      "required": [
        "mode"
      ],
      "type": "object"
    },
    "queue": {
      "properties": {
        "pending": {
          "minimum": 0,
          "type": "integer"
        },
        "spaces": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "quotas": {
      "properties": {
        "blobsPerDay": {
          "minimum": 0,
          "type": "integer"
        },
        "bytesPerDay": {
          "minimum": 0,
          "type": "integer"
        },
        "concurrent": {
          "minimum": 0,
          "type": "integer"
        },
        "writesPerDay": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "registration": {
      "properties": {
        "approvedAt": {
          "format": "datetime",
          "type": "string"
        },
        "approvedBy": {
          "format": "did",
          "type": "string"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "handle": {
          "maxLength": 253,
          "type": "string"
        },
        "pdsUrl": {
          "format": "uri",
          "type": "string"
        },
        "quotas": {
          "ref": "#quotas",
          "type": "ref"
        },
        "reason": {
          "maxLength": 256,
          "type": "string"
        },
        "role": {
          "enum": [
            "delegator",
            "caller"
          ],
          "type": "string"
        },
        "status": {
          "enum": [
            "pending",
            "approved",
            "rejected",
            "suspended"
          ],
          "type": "string"
        },
        "trustLevel": {
          "maxLength": 64,
          "type": "string"
        }
      },
      "required": [
        "did",
        "role",
        "status",
        "createdAt"
      ],
      "type": "object"
    },
    "remaining": {
      "description": "Remaining counters for a caller or delegation in the current window.",
      "properties": {
        "blobsToday": {
          "minimum": 0,
          "type": "integer"
        },
        "bytesToday": {
          "minimum": 0,
          "type": "integer"
        },
        "writesThisMinute": {
          "minimum": 0,
          "type": "integer"
        },
        "writesToday": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "serviceMode": {
      "properties": {
        "callerRegistration": {
          "ref": "#callerRegistration",
          "type": "ref"
        },
        "delegatorOnboarding": {
          "ref": "#delegatorOnboarding",
          "type": "ref"
        },
        "writesEnabled": {
          "type": "boolean"
        }
      },
      "required": [
        "delegatorOnboarding",
        "callerRegistration",
        "writesEnabled"
      ],
      "type": "object"
    },
    "serviceStatus": {
      "properties": {
        "callerRegistration": {
          "ref": "#callerRegistration",
          "type": "ref"
        },
        "counts": {
          "ref": "#counts",
          "type": "ref"
        },
        "delegatorOnboarding": {
          "ref": "#delegatorOnboarding",
          "type": "ref"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "endpoint": {
          "format": "uri",
          "type": "string"
        },
        "limits": {
          "ref": "#limits",
          "type": "ref"
        },
        "queue": {
          "ref": "#queue",
          "type": "ref"
        },
        "service": {
          "maxLength": 128,
          "type": "string"
        },
        "updatedAt": {
          "format": "datetime",
          "type": "string"
        },
        "uptimeMs": {
          "minimum": 0,
          "type": "integer"
        },
        "version": {
          "maxLength": 64,
          "type": "string"
        },
        "writesEnabled": {
          "type": "boolean"
        }
      },
      "required": [
        "service",
        "version",
        "did",
        "endpoint",
        "uptimeMs",
        "delegatorOnboarding",
        "callerRegistration",
        "counts",
        "limits",
        "updatedAt"
      ],
      "type": "object"
    },
    "usage": {
      "description": "Usage counters for a caller or delegation in the current window.",
      "properties": {
        "blobsToday": {
          "minimum": 0,
          "type": "integer"
        },
        "bytesToday": {
          "minimum": 0,
          "type": "integer"
        },
        "writesThisMinute": {
          "minimum": 0,
          "type": "integer"
        },
        "writesToday": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "writeAudit": {
      "properties": {
        "action": {
          "enum": [
            "create",
            "update",
            "delete"
          ],
          "type": "string"
        },
        "caller": {
          "format": "did",
          "type": "string"
        },
        "cid": {
          "maxLength": 128,
          "type": "string"
        },
        "collection": {
          "format": "nsid",
          "type": "string"
        },
        "error": {
          "maxLength": 128,
          "type": "string"
        },
        "id": {
          "minimum": 0,
          "type": "integer"
        },
        "latencyMs": {
          "minimum": 0,
          "type": "integer"
        },
        "rkey": {
          "format": "record-key",
          "type": "string"
        },
        "size": {
          "minimum": 0,
          "type": "integer"
        },
        "status": {
          "maximum": 599,
          "minimum": 100,
          "type": "integer"
        },
        "ts": {
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "id",
        "ts",
        "caller",
        "action",
        "status"
      ],
      "type": "object"
    }
  },
  "description": "Shared shapes for the write delegation proxy control plane. The NSID authority is a placeholder.",
  "id": "party.whey.writeproxy.defs",
  "lexicon": 1
}
```
