{
    "openapi": "3.0.3",
    "info": {
        "title": "OpenStudio API",
        "version": "v1"
    },
    "servers": [
        {
            "url": "https://api.openstudio.one/v1"
        }
    ],
    "paths": {
        "/ping": {
            "get": {
                "summary": "Health check",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "description": "Always the literal string \"pong\" \u2014 confirms the API is reachable and your key(s) authenticated successfully."
                                                },
                                                "brand_id": {
                                                    "type": "integer",
                                                    "description": "Your tenant's brand_id, resolved from whichever key(s) you sent \u2014 a quick way to confirm you're authenticated as the account you expect."
                                                },
                                                "user_id": {
                                                    "type": "integer",
                                                    "nullable": true,
                                                    "description": "Resolved from your `X-Api-User-Key`, if you sent one."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/batch": {
            "post": {
                "summary": "Bundle up to 20 sub-requests into one HTTP call",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "requests": {
                                        "type": "array",
                                        "description": "At most 20 items. Each is dispatched exactly as if you'd called it directly \u2014 same auth, same rate-limit accounting, same everything \u2014 just combined into one round trip for you.",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string",
                                                    "required": false,
                                                    "description": "Your own label for matching a response back to its request. Defaults to the item's position in the array (as a string) if omitted."
                                                },
                                                "method": {
                                                    "type": "string",
                                                    "required": true,
                                                    "enum": [
                                                        "GET",
                                                        "POST",
                                                        "PUT",
                                                        "PATCH",
                                                        "DELETE"
                                                    ],
                                                    "description": "The HTTP method for this sub-request."
                                                },
                                                "url": {
                                                    "type": "string",
                                                    "required": true,
                                                    "description": "Path relative to `/v1`, e.g. `/tickets/123` or `/tickets/123/replies`. Cannot itself be `/batch` \u2014 no nesting."
                                                },
                                                "body": {
                                                    "type": "object",
                                                    "required": false,
                                                    "description": "Only used for `POST`/`PUT`/`PATCH`. Same shape as that endpoint's own documented request body."
                                                },
                                                "idempotency_key": {
                                                    "type": "string",
                                                    "required": false,
                                                    "description": "Forwarded as this ONE sub-request's own `Idempotency-Key` header \u2014 retrying the same batch with the same keys makes each write-endpoint sub-request safe to repeat, exactly like sending that header on a direct call. Only has an effect on endpoints that already support it (currently `POST /tickets` and `POST /tickets/{id}/replies`) \u2014 harmless, silently ignored on any other endpoint. Each sub-request needs its own key; there's no single idempotency key for the batch call as a whole."
                                                }
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "requests"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "responses": {
                                                    "type": "array",
                                                    "description": "Same order as your `requests` array (not completion order, even though sub-requests run in parallel). One failed sub-request does not affect the others \u2014 check each one's own `status`/`body`.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string",
                                                                "description": "Echoes that sub-request's `id` (or its array position, if you didn't supply one)."
                                                            },
                                                            "status": {
                                                                "type": "integer",
                                                                "description": "That sub-request's own HTTP status code \u2014 exactly what you'd have gotten calling it directly. ``502`` specifically means the sub-request itself couldn't be completed (a transport-level failure), not that the target endpoint returned ``502``."
                                                            },
                                                            "body": {
                                                                "type": "object",
                                                                "description": "That sub-request's own full response envelope (`success`/`data`/`error`) \u2014 identical to what a direct call to that endpoint would return."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/applications": {
            "get": {
                "summary": "List every app you can access",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "sections": {
                                                    "type": "array",
                                                    "description": "One entry per sidebar divider (e.g. \"Administration\", \"Data\") \u2014 only dividers with at least one visible app underneath are included.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "key": {
                                                                "type": "string",
                                                                "description": "This section's own internal identifier \u2014 not translated, not guaranteed stable across catalog changes."
                                                            },
                                                            "title": {
                                                                "type": "string",
                                                                "description": "Same identifier as `key` for a section specifically (sections have no separate display value here) \u2014 already resolved to your account's language for `apps`' own `title`, see below."
                                                            },
                                                            "apps": {
                                                                "type": "array",
                                                                "description": "Every visible app/sub-heading under this section, in the same order the web sidebar itself shows them.",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer",
                                                                            "description": "An internal numeric identifier for this app \u2014 the same value the web dashboard's own favorites widget keys its per-app color palette on (`id % 7` against a fixed 7-color set), included so a client can mirror that exactly rather than picking colors some other way. Not meaningful for anything else \u2014 `key` is still the identifier every other endpoint (`favorites`, etc.) expects."
                                                                        },
                                                                        "key": {
                                                                            "type": "string",
                                                                            "description": "This app's own internal identifier \u2014 the value `POST /v1/favorites` expects as `key` when `can_favorite` is `true`."
                                                                        },
                                                                        "title": {
                                                                            "type": "string",
                                                                            "description": "Display name, already resolved to your account's own language \u2014 render as-is."
                                                                        },
                                                                        "url": {
                                                                            "type": "string",
                                                                            "description": "The web dashboard's own internal address for this app. NOT the same string as `key` for most apps."
                                                                        },
                                                                        "url_type": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "view",
                                                                                "external"
                                                                            ],
                                                                            "description": "`external` opens `url` directly (already a full link); `view` means `url` is a value on the web dashboard's own domain, not a standalone URL. Prefer `mobile_integration` below for deciding HOW to open an app on mobile \u2014 this field alone conflates several cases `mobile_integration` distinguishes (see its own description)."
                                                                        },
                                                                        "mobile_integration": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "native",
                                                                                "web_os",
                                                                                "web_ext",
                                                                                "external",
                                                                                "dashboard_os"
                                                                            ],
                                                                            "description": "Admin-controlled \u2014 how the mobile app should open this specific app (see `migrations/024_applications_mobile_integration.sql` for the full decision table). `native`: a real native screen exists. `web_os`: opens in-app, attempts SSO sign-in (the default). `web_ext`: opens in-app, but the sign-in bridge is deliberately skipped (out of the OpenStudio session's scope). `external`: a true third-party link \u2014 opens in-app with no sign-in attempt, same handling as `web_ext` but a PERMANENT classification (\"will likely never integrate\") rather than \"not yet.\" `dashboard_os`: a secondary OpenStudio-hosted dashboard under its own top-level route (not the usual `?view=` convention) \u2014 still attempts SSO, just via `url` directly instead of `/?view={key}`. Not meaningful on a node that has `children` (a collapsible group, not a real destination)."
                                                                        },
                                                                        "icon": {
                                                                            "type": "string",
                                                                            "description": "A raw Font Awesome class name, e.g. `\"fa-address-book\"` \u2014 matches the icon the web dashboard itself shows for this app. Free-form per app, not a fixed enum \u2014 the catalog spans dozens of distinct icons across tenants; render your own fallback for anything you don't recognize rather than assuming full coverage."
                                                                        },
                                                                        "status": {
                                                                            "type": "integer",
                                                                            "enum": [
                                                                                1,
                                                                                0,
                                                                                -1,
                                                                                -2
                                                                            ],
                                                                            "description": "`1` = live (generally available). `0` = beta (visible only to callers in the beta-tester group, same gating the web sidebar itself applies before this app is ever included in the response \u2014 a caller outside that group will simply never see a `0` here). `-1` = maintenance (visible, but expect the app itself to be degraded/unavailable). `-2` = dev (alpha/internal-only, same group-gating as beta, one level more restricted)."
                                                                        },
                                                                        "can_favorite": {
                                                                            "type": "boolean",
                                                                            "description": "`true`: a valid `POST /v1/favorites` target. `false`: shown here (e.g. for browsing/navigation) but rejected as a favorite \u2014 typically a parent/administrative entry rather than something a user would pin to their Home screen. There is no third state."
                                                                        },
                                                                        "description": {
                                                                            "type": "string",
                                                                            "nullable": true,
                                                                            "description": "A short public-facing blurb, when this app has one. `null`, not `\"\"`, when absent."
                                                                        },
                                                                        "children": {
                                                                            "type": "array",
                                                                            "description": "This app's own sub-apps, same object shape as this level, one level deep only (a sub-app's own `children` is never populated \u2014 this catalog doesn't nest further than that). Key is ABSENT (not an empty array) when this app has no sub-apps.",
                                                                            "items": {
                                                                                "type": "object"
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/favorites": {
            "get": {
                "summary": "List your favorite apps",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "favorites": {
                                                    "type": "array",
                                                    "description": "App keys, in order.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Add or remove a favorite app",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "An app key from `GET /v1/applications` (must have `can_favorite: true`) or a native-screen shortcut key."
                                    }
                                },
                                "required": [
                                    "key"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "action": {
                                                    "type": "string",
                                                    "enum": [
                                                        "added",
                                                        "removed"
                                                    ],
                                                    "description": "Whether this call added or removed the app from the caller's favorites."
                                                },
                                                "favorites": {
                                                    "type": "array",
                                                    "description": "The full updated list, in order.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Reorder your favorite apps",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "order": {
                                        "type": "array",
                                        "description": "The full, reordered list of favorited app keys, in the new display order.",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "required": [
                                    "order"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "favorites": {
                                                    "type": "array",
                                                    "description": "The full list in its new order.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol/dashboard": {
            "get": {
                "summary": "Get the IT Protocol app's own dashboard",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "uor",
                        "in": "query",
                        "required": false,
                        "description": "Scope `stats.office` to one specific unit from `available_uors` (matched by `code`), instead of the default aggregated view across every unit you belong to. Silently falls back to the aggregated view if the value isn't one of your own `available_uors`.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "stats": {
                                                    "type": "object",
                                                    "description": "Your two document-count breakdowns \u2014 see `personal`/`office` below.",
                                                    "properties": {
                                                        "personal": {
                                                            "type": "object",
                                                            "description": "Your own RPA/CC/folder standing."
                                                        },
                                                        "office": {
                                                            "type": "object",
                                                            "description": "Your organizational unit(s)' own standing \u2014 `label` names which unit(s) this breakdown covers (every unit you belong to, aggregated, unless `uor` narrowed it to one)."
                                                        }
                                                    }
                                                },
                                                "recent_items": {
                                                    "type": "array",
                                                    "description": "Up to 6 most-recently-viewed protocol documents/dossiers, newest first.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "doc_type": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "protocol",
                                                                    "dossier"
                                                                ],
                                                                "description": "Which detail endpoint this item belongs to \u2014 `protocol` items open via `GET /protocol-documents/{doc_id}`; `dossier` items have no detail endpoint yet."
                                                            },
                                                            "doc_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The id to pass to the relevant detail endpoint. Null only if the underlying record was deleted after being viewed."
                                                            },
                                                            "icon": {
                                                                "type": "string",
                                                                "description": "A semantic hint (e.g. `inbound`/`outbound`/`internal`/`register`/`folder`), not a font/icon-set name \u2014 render your own icon per value."
                                                            },
                                                            "color": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "accent",
                                                                    "ok",
                                                                    "purple",
                                                                    "warn",
                                                                    "muted"
                                                                ],
                                                                "description": "A semantic color hint, not a hex value \u2014 map to your own palette."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "Protocol number (e.g. `00015/2026`) or register/dossier identifier, already formatted."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The document/dossier's own subject line, as entered at registration."
                                                            },
                                                            "viewed_at": {
                                                                "type": "string",
                                                                "description": "MySQL datetime, UTC."
                                                            }
                                                        }
                                                    }
                                                },
                                                "available_uors": {
                                                    "type": "array",
                                                    "description": "Every unit you belong to \u2014 valid values for the `uor` query param above. Empty if you don't belong to any (the office breakdown is then meaningless and can be hidden entirely).",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "code": {
                                                                "type": "string",
                                                                "description": "The unit's short code \u2014 pass this as `uor`."
                                                            },
                                                            "title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display name, when resolvable."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}": {
            "get": {
                "summary": "Get a protocol document \u2014 full detail view",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "document": {
                                                    "type": "object",
                                                    "description": "Core fields \u2014 id, box, display_number (zerofilled), date, oggetto (subject), status, visibility level, etc."
                                                },
                                                "classification": {
                                                    "type": "object",
                                                    "description": "The document's classification \u2014 see also ```GET /reference/protocol-classifications``` for the full pickable list.",
                                                    "properties": {
                                                        "var": {
                                                            "type": "string",
                                                            "description": "The identifier to submit back to ```POST /protocol-documents/{id}/change-classification``` (as `var`) or ```POST /protocol-registration``` (as `classification`) \u2014 distinct from the human-facing `code` below."
                                                        },
                                                        "code": {
                                                            "type": "string",
                                                            "description": "The human-facing roman-numeral/index pair (e.g. `I/4`) \u2014 matches a `classificazione_specifica` row's own `titolo`/`indice`."
                                                        },
                                                        "label": {
                                                            "type": "string",
                                                            "description": "The specific classification's own display title, already resolved via `_lang()` \u2014 never the raw underlying label value, which isn't the real display text."
                                                        },
                                                        "general_label": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The broader general-classification category this specific one rolls up into (e.g. `code` `I/4` belongs to general category `I`), also `_lang()`-resolved."
                                                        },
                                                        "sensitive": {
                                                            "type": "boolean",
                                                            "description": "Whether this document is flagged as containing sensitive personal information."
                                                        }
                                                    }
                                                },
                                                "correspondent": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Sender (arrival/internal) or recipient(s) (departure \u2014 `recipients` array for a multi-recipient document). A sender/recipient carries its own `record_id` \u2014 the registry id to submit back as `correspondent_record_id` on a reply/duplicate registration."
                                                },
                                                "attachments": {
                                                    "type": "array",
                                                    "description": "File list \u2014 `id` (when present) is usable with ```GET /protocol-documents/{id}/files/{file_id}/download``` to view/download that one file, or use ```GET .../download-all``` for a ZIP of everything.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The underlying `fileManager.fileId`, when this attachment uses the modern storage path \u2014 null for a legacy raw-URL attachment (not individually downloadable, only via `download-all`)."
                                                            },
                                                            "filename": {
                                                                "type": "string",
                                                                "description": "The original filename."
                                                            },
                                                            "archived": {
                                                                "type": "boolean",
                                                                "description": "Whether the underlying file has been archived or deleted in storage \u2014 the entry still appears here for a complete record, but the file itself may no longer be retrievable."
                                                            }
                                                        }
                                                    }
                                                },
                                                "deadlines": {
                                                    "type": "array",
                                                    "description": "Every deadline you can see on this document \u2014 your own personal reminders plus every shared one, matching `GET /protocol-documents/{id}/deadlines`' own visibility rule.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Use this in the deadline sub-routes below."
                                                            },
                                                            "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "personal",
                                                                    "shared"
                                                                ],
                                                                "description": "A `personal` deadline is visible only to its own creator; a `shared` one is visible to anyone who can see the document."
                                                            },
                                                            "deadline_date": {
                                                                "type": "string",
                                                                "description": "YYYY-MM-DD \u2014 when this deadline is due."
                                                            },
                                                            "reminder_date": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "YYYY-MM-DD \u2014 an optional earlier reminder date, if one was set."
                                                            },
                                                            "description": {
                                                                "type": "string",
                                                                "description": "What this deadline is for."
                                                            },
                                                            "notes": {
                                                                "type": "string",
                                                                "description": "Free-text notes, separate from `description`."
                                                            },
                                                            "completed": {
                                                                "type": "boolean",
                                                                "description": "Whether this deadline has been marked done."
                                                            },
                                                            "completed_by": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The completing user's personal code, when `completed` is true."
                                                            },
                                                            "completed_at": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "MySQL datetime, UTC, when `completed` is true."
                                                            },
                                                            "can_edit": {
                                                                "type": "boolean",
                                                                "description": "Whether YOU can toggle/delete this specific deadline \u2014 its own creator always can; a shared deadline can also be edited by anyone with `action_on_doc`/founder/RPA standing."
                                                            }
                                                        }
                                                    }
                                                },
                                                "responsibility": {
                                                    "type": "object",
                                                    "description": "Either `rpa` (arrival/departure) or `author`+`original_rpa` (internal), plus `cc` \u2014 an array of CC recipients, each with `can_remove`. Every person object carries `avatar_url` (their real photo, when one exists) and `dep_title` as the FULL Area > Department > Unit hierarchy, not just the immediate structure name."
                                                },
                                                "folders": {
                                                    "type": "array",
                                                    "description": "Folders (dossiers) this document is linked into.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "The dossier id \u2014 use this for the unlink route below."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "The folder's own display number (`id_fascicolo/anno`)."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "description": "The folder's own subject line."
                                                            }
                                                        }
                                                    }
                                                },
                                                "workflow": {
                                                    "type": "array",
                                                    "description": "The document's own workflow log (currently only ever gains a single `close_workflow` entry \u2014 see the close-workflow route below).",
                                                    "items": {
                                                        "type": "object",
                                                        "description": "One workflow event \u2014 `title` (the event name), `dep`/`user_name` (who performed it), `date`."
                                                    }
                                                },
                                                "history": {
                                                    "type": "array",
                                                    "description": "The full audit trail for this document \u2014 every write action taken on it, newest first.",
                                                    "items": {
                                                        "type": "object",
                                                        "description": "One audit entry \u2014 `action` (what happened), `extra` (optional detail), `user_name` (who did it), `user_structure` (their CURRENT structure, Area > Unit \u2014 resolved at read time, not a point-in-time snapshot), `created_at`."
                                                    }
                                                },
                                                "notes": {
                                                    "type": "array",
                                                    "description": "The annotation thread \u2014 private notes from OTHER people are already filtered out server-side.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "This note's own id."
                                                            },
                                                            "user_id": {
                                                                "type": "integer",
                                                                "description": "The author's personal code."
                                                            },
                                                            "user_name": {
                                                                "type": "string",
                                                                "description": "The author's display name."
                                                            },
                                                            "note": {
                                                                "type": "string",
                                                                "description": "The note text."
                                                            },
                                                            "private": {
                                                                "type": "boolean",
                                                                "description": "Whether this note is visible only to its own author (you'll only ever see someone else's private note if it's your own)."
                                                            },
                                                            "is_me": {
                                                                "type": "boolean",
                                                                "description": "Whether YOU are this note's author \u2014 lets a client style your own notes differently, same as a chat thread."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "MySQL datetime, UTC."
                                                            }
                                                        }
                                                    }
                                                },
                                                "retention": {
                                                    "type": "object",
                                                    "description": "The document's data-retention/conservation policy \u2014 `policy` (e.g. `10_years`), `expires_at`, `action` (what happens on expiry), `migrated`/`migrated_at` (whether it's already been moved to cold storage)."
                                                },
                                                "integrity": {
                                                    "type": "object",
                                                    "description": "The document's tamper-evidence seal status.",
                                                    "properties": {
                                                        "sealed": {
                                                            "type": "boolean",
                                                            "description": "Whether a digest has ever been generated for this document \u2014 false for a legacy, never-sealed record."
                                                        },
                                                        "digest": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The current digest value, when sealed."
                                                        }
                                                    }
                                                },
                                                "register": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Present only when this document has been promoted onto a register \u2014 `id`, `name`, `repno` (the register-sequence number), `repdate`."
                                                },
                                                "can": {
                                                    "type": "object",
                                                    "description": "One boolean per tool on the source page \u2014 see this route's own description for what `true` on a not-yet-writable one means."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/notes": {
            "post": {
                "summary": "Add a note/annotation to a document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "note": {
                                        "type": "string"
                                    },
                                    "private": {
                                        "type": "boolean",
                                        "description": "Visible only to you when true. Defaults to false."
                                    }
                                },
                                "required": [
                                    "note"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/cc": {
            "post": {
                "summary": "Add a CC recipient to a document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dep": {
                                        "type": "string",
                                        "description": "A structure acronym."
                                    },
                                    "user": {
                                        "type": "string",
                                        "description": "A personal code, or empty to CC the whole department (rare, matches the source page's own 'whole UOR/office' option)."
                                    }
                                },
                                "required": [
                                    "dep",
                                    "user"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove a CC recipient from a document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "dep",
                        "in": "query",
                        "required": false,
                        "description": "Required \u2014 the structure acronym from the CC entry being removed.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "query",
                        "required": false,
                        "description": "Required \u2014 the personal code from the CC entry being removed (empty string for a whole-department CC entry).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/reject-assignment": {
            "post": {
                "summary": "Reject an arrival document's assignment",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reason": {
                                        "type": "string",
                                        "description": "Why the assignment is being rejected \u2014 recorded in the document history."
                                    }
                                },
                                "required": [
                                    "reason"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/change-classification": {
            "post": {
                "summary": "Change a document's classification",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "var": {
                                        "type": "string",
                                        "description": "A real classification identifier, from ```GET /reference/protocol-classifications```'s `specific[].var`."
                                    }
                                },
                                "required": [
                                    "var"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/request-cancellation": {
            "post": {
                "summary": "Request that a document be cancelled (voided)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reason": {
                                        "type": "string",
                                        "description": "Why this document should be cancelled."
                                    }
                                },
                                "required": [
                                    "reason"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/change-rpa": {
            "post": {
                "summary": "Reassign the document's Responsible (RPA)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "resp_dep": {
                                        "type": "string",
                                        "description": "The new RPA's structure acronym."
                                    },
                                    "resp_user": {
                                        "type": "string",
                                        "description": "The new RPA's personal code."
                                    },
                                    "move_old_rpa_to_cc": {
                                        "type": "boolean",
                                        "description": "CC the outgoing RPA instead of dropping them from the document. Defaults to false."
                                    }
                                },
                                "required": [
                                    "resp_dep",
                                    "resp_user"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/update-retention": {
            "post": {
                "summary": "Update a document's retention (conservation) policy",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "policy": {
                                        "type": "string",
                                        "description": "`permanent`, or a number of years as a string, e.g. `10_years`."
                                    },
                                    "action": {
                                        "type": "string",
                                        "description": "`migrate` or `delete` \u2014 what happens once the policy expires. Defaults to `migrate`."
                                    }
                                },
                                "required": [
                                    "policy"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/registers": {
            "get": {
                "summary": "List the registers this document could be assigned to",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "registers": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "code": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/assign-register": {
            "post": {
                "summary": "Also file this document into a register",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "register_id": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "register_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "register_id": {
                                                    "type": "integer"
                                                },
                                                "repno": {
                                                    "type": "integer",
                                                    "description": "The newly-assigned register entry number."
                                                },
                                                "year": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/seal": {
            "post": {
                "summary": "Generate an integrity seal for a legacy document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/download-all": {
            "get": {
                "summary": "Download every attached file as a ZIP",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "string",
                                                "format": "binary",
                                                "description": "The ZIP file, streamed directly (`Content-Type: application/zip`)."
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/files": {
            "post": {
                "summary": "Attach a new file to an already-registered document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file_base64": {
                                        "type": "string"
                                    },
                                    "filename": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "file_base64",
                                    "filename"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new fileManager.fileId."
                                                },
                                                "filename": {
                                                    "type": "string",
                                                    "description": "The name it was actually saved as \u2014 suffixed if a same-named file already existed."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/files/{file_id}/download": {
            "get": {
                "summary": "Download one attachment",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "string",
                                                "format": "binary",
                                                "description": "The file, streamed directly with its own real Content-Type."
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/deadlines": {
            "post": {
                "summary": "Add a deadline to a document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "deadline_date": {
                                        "type": "string",
                                        "description": "YYYY-MM-DD."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "What this deadline is for."
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Free-text notes, separate from `description`."
                                    },
                                    "reminder_date": {
                                        "type": "string",
                                        "description": "YYYY-MM-DD."
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "personal",
                                            "shared"
                                        ],
                                        "description": "Defaults to personal."
                                    }
                                },
                                "required": [
                                    "deadline_date"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                },
                                                "type": {
                                                    "type": "string",
                                                    "description": "The type actually applied \u2014 may differ from the request, see description."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/deadlines/{deadline_id}": {
            "patch": {
                "summary": "Toggle a deadline complete/reopen",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                },
                                                "completed": {
                                                    "type": "boolean",
                                                    "description": "The new state after toggling."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a deadline",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/close-workflow": {
            "post": {
                "summary": "Close a document's workflow",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/dossiers": {
            "post": {
                "summary": "Link a document to a folder (dossier)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dossier_id": {
                                        "type": "integer",
                                        "description": "The target folder's own `id` (from `GET /protocol-dossiers`), not its display number."
                                    }
                                },
                                "required": [
                                    "dossier_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-documents/{id}/dossiers/{dossier_id}": {
            "delete": {
                "summary": "Unlink a document from a folder (dossier)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/protocol-classifications": {
            "get": {
                "summary": "Get the Protocol app's classification tree",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "general": {
                                                    "type": "array",
                                                    "description": "The top-level category list.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "titolo": {
                                                                "type": "string",
                                                                "description": "The roman-numeral group code (e.g. `I`) \u2014 matches `specific[].titolo`."
                                                            },
                                                            "var": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The lang_var `label` was resolved from."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "Display title, already `_lang()`-resolved."
                                                            }
                                                        }
                                                    }
                                                },
                                                "specific": {
                                                    "type": "array",
                                                    "description": "The full flat list of specific classifications \u2014 a document's own `classification.code`/`.label` always come from one row here.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "code": {
                                                                "type": "string",
                                                                "description": "`titolo`/`indice` combined \u2014 matches `GET /protocol-documents/{id}`'s own `classification.code`."
                                                            },
                                                            "titolo": {
                                                                "type": "string",
                                                                "description": "This row's own group code \u2014 matches a `general[].titolo`."
                                                            },
                                                            "indice": {
                                                                "type": "string",
                                                                "description": "The sub-index within that group."
                                                            },
                                                            "var": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The lang_var `label` was resolved from \u2014 this is also the exact value a document's own `classification.var` stores."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "Display title, already `_lang()`-resolved."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers": {
            "get": {
                "summary": "Search/list folders (dossiers)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against subject, folder number, and notes.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to `open`.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "closed",
                                "all"
                            ]
                        }
                    },
                    {
                        "name": "classification",
                        "in": "query",
                        "required": false,
                        "description": "Exact match against a specific classification `var` (see `GET /reference/protocol-classifications`).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "my_rpa",
                        "in": "query",
                        "required": false,
                        "description": "Only folders you personally own (RPA). Mirrors the Dashboard's own \"Folders I manage\" stat.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "my_cc",
                        "in": "query",
                        "required": false,
                        "description": "Only folders you're personally in CC on. Mirrors the Dashboard's own \"Folders (CC)\" stat.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "rpa",
                        "in": "query",
                        "required": false,
                        "description": "Exact match against an arbitrary hr_id \u2014 App Support #572, used for scoping \"which folders can this document link into\" (RPA + classification alignment), distinct from `my_rpa` (always the caller's own id).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "exclude_doc_id",
                        "in": "query",
                        "required": false,
                        "description": "Excludes folders a given document is already linked into.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "peek_next_id",
                        "in": "query",
                        "required": false,
                        "description": "A completely different, lightweight response shape \u2014 see the dedicated summary below. When set, every other param on this route is ignored.",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "dossiers": {
                                                    "type": "array",
                                                    "description": "Up to 200 results, newest folder-year/number first.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Use this for `GET /protocol-dossiers/{id}`."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "The folder's own display number (`id_fascicolo/anno`)."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "description": "The folder's own subject/title."
                                                            },
                                                            "rpa_user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The owning person's personal code."
                                                            },
                                                            "rpa_user_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The owning person's display name."
                                                            },
                                                            "uor": {
                                                                "type": "string",
                                                                "description": "The owning structure's acronym."
                                                            },
                                                            "uor_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display name for `uor`, when resolvable."
                                                            },
                                                            "status": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    0,
                                                                    1
                                                                ],
                                                                "description": "0 = open, 1 = closed."
                                                            },
                                                            "document_count": {
                                                                "type": "integer",
                                                                "description": "How many documents are linked into this folder."
                                                            },
                                                            "access_reason": {
                                                                "type": "string",
                                                                "description": "Why you can see this result (e.g. `RPA (Owner)`, `Department Membership (UOR)`, `CC (Read Only)`) \u2014 same reasons `GET /protocol-dossiers/{id}` itself reports."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Create a new folder (dossier)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "oggetto": {
                                        "type": "string",
                                        "description": "The subject/title."
                                    },
                                    "classificazione": {
                                        "type": "string",
                                        "description": "A specific classification `var`, from `GET /reference/protocol-classifications`."
                                    },
                                    "uor": {
                                        "type": "string",
                                        "description": "The owning structure's acronym."
                                    },
                                    "rpa": {
                                        "type": "string",
                                        "description": "The owning user's personal code."
                                    },
                                    "anno": {
                                        "type": "integer",
                                        "description": "Defaults to the current year."
                                    },
                                    "note": {
                                        "type": "string",
                                        "description": "Free-text notes for the new folder."
                                    },
                                    "q_visibility": {
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1,
                                            2,
                                            3
                                        ],
                                        "description": "Defaults to 0 (public)."
                                    },
                                    "father_id": {
                                        "type": "integer",
                                        "description": "Makes this a sub-folder of an existing ROOT folder you own \u2014 must itself have no parent and belong to you, same constraint as the source page's own picker."
                                    }
                                },
                                "required": [
                                    "oggetto",
                                    "classificazione",
                                    "uor",
                                    "rpa"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new folder's own id."
                                                },
                                                "label": {
                                                    "type": "string",
                                                    "description": "The generated display number."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}": {
            "get": {
                "summary": "Get a folder (dossier) \u2014 full detail view",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "dossier": {
                                                    "type": "object",
                                                    "description": "Core fields.",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "This folder's own id \u2014 use it for every sub-route below."
                                                        },
                                                        "label": {
                                                            "type": "string",
                                                            "description": "Display number (`id_fascicolo/anno`)."
                                                        },
                                                        "subject": {
                                                            "type": "string",
                                                            "description": "The folder's own subject/title."
                                                        },
                                                        "note": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Free-text notes."
                                                        },
                                                        "status": {
                                                            "type": "integer",
                                                            "enum": [
                                                                0,
                                                                1
                                                            ],
                                                            "description": "0 = open, 1 = closed."
                                                        },
                                                        "q_visibility": {
                                                            "type": "integer",
                                                            "description": "Same 0-3 visibility scale as a document's own `document.q_visibility`."
                                                        },
                                                        "created_at": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "MySQL datetime, UTC."
                                                        },
                                                        "closed_at": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "MySQL datetime, UTC, when `status` is 1."
                                                        }
                                                    }
                                                },
                                                "classification": {
                                                    "type": "object",
                                                    "description": "The folder's classification.",
                                                    "properties": {
                                                        "code": {
                                                            "type": "string",
                                                            "description": "The `titolo`/`indice` pair, e.g. `I/4`."
                                                        },
                                                        "label": {
                                                            "type": "string",
                                                            "description": "Already `_lang()`-resolved \u2014 see `GET /reference/protocol-classifications`'s own note on why this isn't the raw underlying label value."
                                                        }
                                                    }
                                                },
                                                "rpa": {
                                                    "type": "object",
                                                    "description": "The folder's owning structure + person.",
                                                    "properties": {
                                                        "dep": {
                                                            "type": "string",
                                                            "description": "The owning structure's acronym."
                                                        },
                                                        "dep_title": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Display name for `dep`, when resolvable."
                                                        },
                                                        "user_id": {
                                                            "type": "integer",
                                                            "nullable": true,
                                                            "description": "The owning person's personal code."
                                                        },
                                                        "user_name": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The owning person's display name."
                                                        }
                                                    }
                                                },
                                                "created_by": {
                                                    "type": "object",
                                                    "description": "Who created this folder.",
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer",
                                                            "nullable": true,
                                                            "description": "The creator's personal code."
                                                        },
                                                        "user_name": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The creator's display name."
                                                        },
                                                        "dep": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The creator's own department at the time of creation."
                                                        }
                                                    }
                                                },
                                                "cc": {
                                                    "type": "array",
                                                    "description": "Every CC entry on this folder.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "dep": {
                                                                "type": "string",
                                                                "description": "A structure acronym."
                                                            },
                                                            "dep_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display name for `dep`, when resolvable."
                                                            },
                                                            "user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "A personal code, or null for a whole-department CC entry."
                                                            },
                                                            "user_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The CC'd person's display name, when `user_id` is set."
                                                            },
                                                            "can_remove": {
                                                                "type": "boolean",
                                                                "description": "Whether YOU can remove this specific CC entry."
                                                            }
                                                        }
                                                    }
                                                },
                                                "documents": {
                                                    "type": "array",
                                                    "description": "Every document linked into this folder.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Use this with ```GET /protocol-documents/{id}```."
                                                            },
                                                            "box": {
                                                                "type": "string",
                                                                "description": "The document's own type \u2014 `arrivo`/`uscita`/`interno`."
                                                            },
                                                            "display_number": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The document's own protocol number, when it has one (null for a register entry with no protocol number yet)."
                                                            },
                                                            "date": {
                                                                "type": "string",
                                                                "description": "The document's own registration date."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "description": "The document's own subject line."
                                                            },
                                                            "mismatch": {
                                                                "type": "boolean",
                                                                "description": "True when this document's own department or classification has drifted from the folder's \u2014 the source page's own \"align\" tool (not yet implemented here, see this route's own `can`) fixes this."
                                                            }
                                                        }
                                                    }
                                                },
                                                "parent": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "The folder this one is nested under, if any.",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "The parent folder's own id."
                                                        },
                                                        "label": {
                                                            "type": "string",
                                                            "description": "Display number."
                                                        },
                                                        "subject": {
                                                            "type": "string",
                                                            "description": "Subject/title."
                                                        }
                                                    }
                                                },
                                                "children": {
                                                    "type": "array",
                                                    "description": "Folders nested directly under this one.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "The child folder's own id."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "Display number."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "description": "Subject/title."
                                                            }
                                                        }
                                                    }
                                                },
                                                "notes": {
                                                    "type": "array",
                                                    "description": "The annotation thread \u2014 same shape and same \"others' private notes filtered out\" rule as ```GET /protocol-documents/{id}```'s own `notes`.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "This note's own id."
                                                            },
                                                            "user_id": {
                                                                "type": "integer",
                                                                "description": "The author's personal code."
                                                            },
                                                            "user_name": {
                                                                "type": "string",
                                                                "description": "The author's display name."
                                                            },
                                                            "note": {
                                                                "type": "string",
                                                                "description": "The note text."
                                                            },
                                                            "private": {
                                                                "type": "boolean",
                                                                "description": "Whether this note is visible only to its own author."
                                                            },
                                                            "is_me": {
                                                                "type": "boolean",
                                                                "description": "Whether YOU are this note's author."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "MySQL datetime, UTC."
                                                            }
                                                        }
                                                    }
                                                },
                                                "history": {
                                                    "type": "array",
                                                    "description": "The folder's own audit trail.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "action": {
                                                                "type": "string",
                                                                "description": "What happened."
                                                            },
                                                            "user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "Who did it."
                                                            },
                                                            "user_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The actor's display name."
                                                            },
                                                            "user_structure": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The actor's CURRENT structure (Area > Unit), resolved at read time."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "MySQL datetime, UTC."
                                                            }
                                                        }
                                                    }
                                                },
                                                "access_reason": {
                                                    "type": "string",
                                                    "description": "Why you can see this folder \u2014 see this route's own description."
                                                },
                                                "can": {
                                                    "type": "object",
                                                    "description": "One boolean per tool \u2014 `true` on `change_rpa`/`change_classification`/`align_mismatched_documents` means you have permission, not that a write endpoint exists yet for it (real, documented scope cut)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Update a folder's own subject/notes",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "oggetto": {
                                        "type": "string",
                                        "description": "Renames the folder."
                                    },
                                    "note": {
                                        "type": "string",
                                        "description": "Replaces the folder's own notes."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/close": {
            "post": {
                "summary": "Close a folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "note": {
                                        "type": "string",
                                        "description": "Appended to the folder's own notes as a closing remark."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/reopen": {
            "post": {
                "summary": "Reopen a closed folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/cc": {
            "post": {
                "summary": "Add a CC entry to a folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dep": {
                                        "type": "string",
                                        "description": "A structure acronym."
                                    },
                                    "user": {
                                        "type": "string",
                                        "description": "A personal code. Omit to CC the whole department."
                                    }
                                },
                                "required": [
                                    "dep"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove a CC entry from a folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "dep",
                        "in": "query",
                        "required": false,
                        "description": "Required.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "query",
                        "required": false,
                        "description": "Required (empty string for a whole-department entry).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/notes": {
            "post": {
                "summary": "Add a note/annotation to a folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "note": {
                                        "type": "string",
                                        "description": "The note text."
                                    },
                                    "private": {
                                        "type": "boolean",
                                        "description": "Visible only to you when true."
                                    }
                                },
                                "required": [
                                    "note"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/eligible-documents": {
            "get": {
                "summary": "Search documents this folder could link",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against subject or protocol number.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "documents": {
                                                    "type": "array",
                                                    "description": "Up to 50 matches.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Pass this as `doc_id` to the link route."
                                                            },
                                                            "box": {
                                                                "type": "string",
                                                                "description": "The document's own type \u2014 `arrivo`/`uscita`/`interno`."
                                                            },
                                                            "display_number": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The document's own protocol number, when it has one."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "description": "The document's own subject line."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/documents": {
            "post": {
                "summary": "Link a document into a folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "doc_id": {
                                        "type": "integer",
                                        "description": "From ```GET /protocol-dossiers/{id}/eligible-documents```."
                                    }
                                },
                                "required": [
                                    "doc_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/documents/{document_id}": {
            "delete": {
                "summary": "Unlink a document from a folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-dossiers/{id}/parent": {
            "post": {
                "summary": "Set or clear a folder's parent folder",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "father_id": {
                                        "type": "integer",
                                        "description": "Omit or `0` to clear."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "description": "Always true \u2014 a failed attempt returns an error response instead."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/registry": {
            "get": {
                "summary": "Search the Registry",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against the record id, first/last name, and the composite display name.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to `all`.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "person",
                                "structure",
                                "all"
                            ]
                        }
                    },
                    {
                        "name": "scope",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to `all`. `internal` means linked to a real system user/structure.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "internal",
                                "external",
                                "all"
                            ]
                        }
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against email or certified email (PEC).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "city",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against home city, birth city, or home address.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "taxcode",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against fiscal code or VAT number.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "results": {
                                                    "type": "array",
                                                    "description": "Up to 50 results, alphabetical by display name. Merged-away (duplicate) records are never returned.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "record_id": {
                                                                "type": "integer",
                                                                "description": "This record's own id \u2014 use it for GET /registry/{record_id}."
                                                            },
                                                            "display_number": {
                                                                "type": "string",
                                                                "description": "Zero-padded 5-digit display form of `record_id`."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "description": "Composite display name."
                                                            },
                                                            "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "person",
                                                                    "structure"
                                                                ]
                                                            },
                                                            "is_internal": {
                                                                "type": "boolean",
                                                                "description": "Whether this record is linked to a real system user/structure."
                                                            },
                                                            "system_id": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The linked system id, when `is_internal` is true."
                                                            },
                                                            "is_aligned": {
                                                                "type": "boolean",
                                                                "nullable": true,
                                                                "description": "For an internal record: whether its own structure/responsible assignment currently matches one of its real system role contexts (department membership/leadership). Null for an external record \u2014 the concept doesn't apply."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Create a new EXTERNAL Registry record",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "person",
                                            "structure"
                                        ]
                                    },
                                    "first_name": {
                                        "type": "string",
                                        "description": "Required for type=person."
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Required for type=person."
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Required for type=structure \u2014 the structure's own name."
                                    },
                                    "sex": {
                                        "type": "string"
                                    },
                                    "birth_date": {
                                        "type": "string",
                                        "description": "YYYY-MM-DD. Person only."
                                    },
                                    "birth_city": {
                                        "type": "string"
                                    },
                                    "birth_province": {
                                        "type": "string"
                                    },
                                    "birth_state": {
                                        "type": "string"
                                    },
                                    "citizenship": {
                                        "type": "string"
                                    },
                                    "role": {
                                        "type": "string",
                                        "description": "Person only \u2014 their role/title."
                                    },
                                    "structure_record_id": {
                                        "type": "integer",
                                        "nullable": true,
                                        "description": "Person only \u2014 their membership structure, a real registry record id."
                                    },
                                    "responsible_record_id": {
                                        "type": "integer",
                                        "nullable": true,
                                        "description": "Structure only \u2014 its own responsible person, a real registry record id."
                                    },
                                    "taxcode": {
                                        "type": "string"
                                    },
                                    "vat_number": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "pec": {
                                        "type": "string"
                                    },
                                    "website": {
                                        "type": "string"
                                    },
                                    "phone_number": {
                                        "type": "string"
                                    },
                                    "mobile_number": {
                                        "type": "string"
                                    },
                                    "fax_number": {
                                        "type": "string"
                                    },
                                    "home_address": {
                                        "type": "string"
                                    },
                                    "home_city": {
                                        "type": "string"
                                    },
                                    "home_district": {
                                        "type": "string"
                                    },
                                    "home_country": {
                                        "type": "string"
                                    },
                                    "home_postcode": {
                                        "type": "string"
                                    },
                                    "note": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object",
                                                "description": "The newly-created record, same shape as one row of GET /registry's own results."
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/registry/{id}": {
            "get": {
                "summary": "Get a Registry record \u2014 full profile",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "record_id": {
                                                    "type": "integer",
                                                    "description": "This record's own id."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Composite display name."
                                                },
                                                "type": {
                                                    "type": "string",
                                                    "enum": [
                                                        "person",
                                                        "structure"
                                                    ]
                                                },
                                                "is_internal": {
                                                    "type": "boolean",
                                                    "description": "Whether linked to a real system user/structure."
                                                },
                                                "linked_uid": {
                                                    "type": "integer",
                                                    "nullable": true,
                                                    "description": "The linked system user's own login id, when resolvable."
                                                },
                                                "structure": {
                                                    "type": "object",
                                                    "description": "This record's own structure assignment.",
                                                    "properties": {
                                                        "record_id": {
                                                            "type": "integer",
                                                            "nullable": true
                                                        },
                                                        "display": {
                                                            "type": "string",
                                                            "nullable": true
                                                        }
                                                    }
                                                },
                                                "responsible": {
                                                    "type": "object",
                                                    "description": "This record's own responsible-person assignment.",
                                                    "properties": {
                                                        "record_id": {
                                                            "type": "integer",
                                                            "nullable": true
                                                        },
                                                        "display": {
                                                            "type": "string",
                                                            "nullable": true
                                                        }
                                                    }
                                                },
                                                "contexts": {
                                                    "type": "array",
                                                    "description": "Real system role contexts (Founder/Area Manager/Dept. Leader/Employee) for an internal person \u2014 empty for a structure or an external/unlinked person.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "role": {
                                                                "type": "string"
                                                            },
                                                            "department_label": {
                                                                "type": "string"
                                                            },
                                                            "reports_to": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "status": {
                                                                        "type": "string"
                                                                    },
                                                                    "record_id": {
                                                                        "type": "integer",
                                                                        "nullable": true
                                                                    },
                                                                    "label": {
                                                                        "type": "string"
                                                                    }
                                                                }
                                                            },
                                                            "active": {
                                                                "type": "boolean",
                                                                "description": "Whether this specific context matches this record's own current structure/responsible assignment."
                                                            }
                                                        }
                                                    }
                                                },
                                                "is_aligned": {
                                                    "type": "boolean",
                                                    "description": "Whether the structure/responsible assignment above currently matches a real system role context."
                                                },
                                                "merged_survivor": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "If this record was merged into another (duplicate-merging isn't migrated here), the surviving record to redirect to. This record itself always stays resolvable \u2014 historical references must keep working."
                                                },
                                                "mismatches": {
                                                    "type": "array",
                                                    "description": "Fields that differ between this registry record and its linked system user, for `POST /registry/{id}/sync`. Empty when not internal, or when there's nothing to sync.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "field": {
                                                                "type": "string"
                                                            },
                                                            "registry_value": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "system_value": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "suggested_direction": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "to_registry",
                                                                    "to_system"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                },
                                                "can": {
                                                    "type": "object",
                                                    "description": "Your real edit/sync permission for THIS record \u2014 `edit`/`sync` booleans."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Edit a Registry record",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "first_name": {
                                        "type": "string"
                                    },
                                    "last_name": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "For a structure record (`type: \"structure\"`) only \u2014 its own single display name field."
                                    },
                                    "taxcode": {
                                        "type": "string"
                                    },
                                    "vat_number": {
                                        "type": "string"
                                    },
                                    "sex": {
                                        "type": "string"
                                    },
                                    "citizenship": {
                                        "type": "string"
                                    },
                                    "citizenship_other": {
                                        "type": "string"
                                    },
                                    "birth_date": {
                                        "type": "string",
                                        "description": "YYYY-MM-DD, or null to clear."
                                    },
                                    "birth_city": {
                                        "type": "string"
                                    },
                                    "birth_province": {
                                        "type": "string"
                                    },
                                    "birth_state": {
                                        "type": "string"
                                    },
                                    "home_address": {
                                        "type": "string"
                                    },
                                    "home_number": {
                                        "type": "string"
                                    },
                                    "home_postcode": {
                                        "type": "string"
                                    },
                                    "home_city": {
                                        "type": "string"
                                    },
                                    "home_district": {
                                        "type": "string"
                                    },
                                    "home_country": {
                                        "type": "string"
                                    },
                                    "home_co": {
                                        "type": "string",
                                        "description": "Care-of / attention-line, for the home address."
                                    },
                                    "home_date": {
                                        "type": "string",
                                        "description": "YYYY-MM-DD, or null to clear."
                                    },
                                    "mobile_number": {
                                        "type": "string"
                                    },
                                    "phone_number": {
                                        "type": "string"
                                    },
                                    "fax_number": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "pec": {
                                        "type": "string",
                                        "description": "Certified email (PEC), an Italian legal-mail concept \u2014 a real, distinct field from `email`."
                                    },
                                    "note": {
                                        "type": "string"
                                    },
                                    "structure_record_id": {
                                        "type": "integer",
                                        "description": "Sets this record's own structure assignment \u2014 pass another registry record's id (or a resolvable system id), or null to clear."
                                    },
                                    "responsible_record_id": {
                                        "type": "integer",
                                        "description": "Sets this record's own responsible-person assignment, same resolution as `structure_record_id`."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/registry/{id}/sync": {
            "post": {
                "summary": "Apply a Registry <-> system-user field sync",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "fields": {
                                        "type": "array",
                                        "description": "Each entry: `{field, direction}` \u2014 `field` is one of the names from `GET /registry/{id}`'s own `mismatches`, `direction` is `to_registry` (system user -> registry) or `to_system` (registry -> system user).",
                                        "items": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "required": [
                                    "fields"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-search": {
            "get": {
                "summary": "Unified Protocol document search",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to `global` (every box you have visibility into). A specific type 403s if you lack that box's own view permission.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "global",
                                "arrival",
                                "departure",
                                "internal",
                                "register"
                            ]
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Substring/regex match against subject, classification, notes, keywords, attachment filenames, means of transmission, external protocol reference, and sender/recipient name or email.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to `active` (everything except cancelled).",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "active",
                                "cancelled",
                                "returned",
                                "all"
                            ]
                        }
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "description": "YYYY-MM-DD, inclusive.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "description": "YYYY-MM-DD, inclusive.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "year",
                        "in": "query",
                        "required": false,
                        "description": "Matches either the registration year or the original (imported) document year.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "classification",
                        "in": "query",
                        "required": false,
                        "description": "Substring/regex match against the classification `var`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "dep",
                        "in": "query",
                        "required": false,
                        "description": "A structure acronym \u2014 matches either the posting or the owning (RPA) department.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "role",
                        "in": "query",
                        "required": false,
                        "description": "Documents where you are the RPA (`mine_rpa`), where you personally appear in the CC list (`mine_cc`), where one of your OWN structures appears in the CC list (`uor_cc`), or that you authored (`mine_author`) \u2014 mirrors the Dashboard widget's own 4 personal-tab links.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "mine_rpa",
                                "mine_cc",
                                "uor_cc",
                                "mine_author"
                            ]
                        }
                    },
                    {
                        "name": "in_folder",
                        "in": "query",
                        "required": false,
                        "description": "Whether the document has already been placed into a folder. Mirrors the Dashboard's own \"to be filed\" stat when combined with `role=mine_rpa`.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "yes",
                                "no"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": {
                                                    "type": "string",
                                                    "description": "The resolved search type (never `global` unresolved \u2014 reflects what was actually queried)."
                                                },
                                                "results": {
                                                    "type": "array",
                                                    "description": "Up to 100 results, newest first.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Use this with `GET /protocol-documents/{id}`."
                                                            },
                                                            "box": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "arrivo",
                                                                    "uscita",
                                                                    "interno"
                                                                ],
                                                                "description": "The document's own type."
                                                            },
                                                            "display_number": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Protocol number, or register number when registered but not yet protocol-numbered. Null for a register-only entry with neither yet."
                                                            },
                                                            "date": {
                                                                "type": "string",
                                                                "description": "MySQL datetime."
                                                            },
                                                            "subject": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "integer",
                                                                "description": "Raw status code (-1 cancelled, 3 returned, others active/workflow states)."
                                                            },
                                                            "status_label": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "Active",
                                                                    "Cancelled",
                                                                    "Returned"
                                                                ]
                                                            },
                                                            "classification": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The classification `var` \u2014 resolve a real label via `GET /reference/protocol-classifications`."
                                                            },
                                                            "is_register": {
                                                                "type": "boolean",
                                                                "description": "Whether this document also has a register entry."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-uop-inbox": {
            "get": {
                "summary": "List the UOP (Protocol Office) incoming-mail inbox",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "view",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to `pending` (not yet triaged).",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "history",
                                "spam"
                            ]
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against sender, subject, or body.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "mailbox",
                        "in": "query",
                        "required": false,
                        "description": "Exact match against one of `mailboxes`' own `value`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "description": "YYYY-MM-DD, inclusive.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "description": "YYYY-MM-DD, inclusive.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "25 per page, defaults to 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "view": {
                                                    "type": "string",
                                                    "description": "The resolved tab."
                                                },
                                                "tab_counts": {
                                                    "type": "object",
                                                    "description": "Pending/history/spam counts, always for ALL tabs regardless of `view`.",
                                                    "properties": {
                                                        "pending": {
                                                            "type": "integer"
                                                        },
                                                        "history": {
                                                            "type": "integer"
                                                        },
                                                        "spam": {
                                                            "type": "integer"
                                                        }
                                                    }
                                                },
                                                "items": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Use this with GET /protocol-uop-inbox/{id}."
                                                            },
                                                            "sender": {
                                                                "type": "string"
                                                            },
                                                            "subject": {
                                                                "type": "string"
                                                            },
                                                            "received_at": {
                                                                "type": "string",
                                                                "description": "MySQL datetime."
                                                            },
                                                            "mailbox": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The receiving mailbox's own display label, falling back to its raw address."
                                                            },
                                                            "linked_doc_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "Set once this email has already been registered as a Protocol document \u2014 use with GET /protocol-documents/{id}."
                                                            },
                                                            "linked_prot_id": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The linked document's own protocol number, when set."
                                                            }
                                                        }
                                                    }
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "total_pages": {
                                                    "type": "integer"
                                                },
                                                "mailboxes": {
                                                    "type": "array",
                                                    "description": "Every mailbox this brand has ever received into, for the `mailbox` filter.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "value": {
                                                                "type": "string"
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-uop-inbox/{id}": {
            "get": {
                "summary": "Preview one UOP inbox email",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "sender": {
                                                    "type": "string"
                                                },
                                                "subject": {
                                                    "type": "string"
                                                },
                                                "body": {
                                                    "type": "string",
                                                    "description": "Raw email HTML body, with `<script>` tags stripped."
                                                },
                                                "received_at": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "new",
                                                        "registered",
                                                        "ignored",
                                                        "spam"
                                                    ]
                                                },
                                                "files": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "A `fileManager` id \u2014 resolve via the FileManager, not a raw URL."
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-uop-inbox/{id}/ignore": {
            "post": {
                "summary": "Archive a pending UOP inbox email",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-uop-inbox/{id}/spam": {
            "post": {
                "summary": "Report a pending UOP inbox email as spam",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-uop-inbox/{id}/files/{file_id}/download": {
            "get": {
                "summary": "Download a UOP inbox email attachment",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "string",
                                                "description": "Raw binary response, not JSON \u2014 Content-Type reflects the file's own type."
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-cancellation-requests": {
            "get": {
                "summary": "List document cancellation requests",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to `pending`.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "resolved"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string"
                                                },
                                                "items": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Use this with the approve/refuse routes below."
                                                            },
                                                            "doc_id": {
                                                                "type": "integer",
                                                                "description": "Use with GET /protocol-documents/{id}."
                                                            },
                                                            "document_display_number": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "document_date": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "requested_at": {
                                                                "type": "string"
                                                            },
                                                            "requester_id": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "requester_name": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "reason": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "pending",
                                                                    "approved",
                                                                    "refused"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-cancellation-requests/{id}/approve": {
            "post": {
                "summary": "Approve a cancellation request \u2014 voids the document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "doc_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-cancellation-requests/{id}/refuse": {
            "post": {
                "summary": "Refuse a cancellation request \u2014 document stays as-is",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                },
                                                "doc_id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/protocol-registration": {
            "post": {
                "summary": "Register a new Protocol document (Arrival/Departure/Internal)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "box": {
                                        "type": "string",
                                        "enum": [
                                            "arrival",
                                            "departure",
                                            "internal"
                                        ]
                                    },
                                    "subject": {
                                        "type": "string"
                                    },
                                    "classification": {
                                        "type": "string",
                                        "description": "A specific classification `var`, from `GET /reference/protocol-classifications`."
                                    },
                                    "correspondent_record_id": {
                                        "type": "integer",
                                        "description": "A Registry record id (`GET /registry`) \u2014 required for `arrival` (the sender) and `departure` (the recipient); not used for `internal`."
                                    },
                                    "resp_dep": {
                                        "type": "string",
                                        "description": "The RPA's own structure acronym \u2014 unrestricted (any real department, see GET /reference/protocol-structure-people for who's assignable within it). Defaults to your own primary structure."
                                    },
                                    "resp_user": {
                                        "type": "string",
                                        "description": "The RPA person's personal code. Defaults to you."
                                    },
                                    "posted_by_dep": {
                                        "type": "string",
                                        "description": "Which UOR you're registering this document ON BEHALF OF \u2014 a real, SEPARATE field from resp_dep/resp_user above. Must be one of GET /reference/protocol-manageable-uors' own list (your primary department, or a UOR you hold a real Level-2 management grant on) \u2014 a 403 otherwise. Defaults to your own primary department."
                                    },
                                    "routed_to_dep": {
                                        "type": "string",
                                        "description": "For an internal document: the receiving structure's acronym."
                                    },
                                    "routed_to_user": {
                                        "type": "string",
                                        "description": "For an internal document: the receiving person's personal code."
                                    },
                                    "note": {
                                        "type": "string"
                                    },
                                    "keywords": {
                                        "type": "string"
                                    },
                                    "transmission_means": {
                                        "type": "string",
                                        "description": "How this arrived/was sent (mail, PEC, hand-delivered, etc)."
                                    },
                                    "external_reference": {
                                        "type": "string",
                                        "description": "The sender's own protocol reference, when known."
                                    },
                                    "visibility": {
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1,
                                            2,
                                            3
                                        ],
                                        "description": "Defaults to 0 (public)."
                                    },
                                    "sensitive": {
                                        "type": "boolean"
                                    },
                                    "cc": {
                                        "type": "array",
                                        "description": "CC recipients at creation time \u2014 an array of {dep, user}, each a real department acronym + personal code pair."
                                    },
                                    "retention_policy": {
                                        "type": "string"
                                    },
                                    "retention_action": {
                                        "type": "string",
                                        "description": "What happens once retention expires \u2014 coerced to delete when no cold-storage endpoint is configured (see GET /reference/protocol-manageable-uors' own has_storage_endpoint)."
                                    },
                                    "external_reference_date": {
                                        "type": "string",
                                        "description": "The correspondent's own reference DATE (YYYY-MM-DD) \u2014 distinct from external_reference (their reference NUMBER). No dedicated column on web either; appended to `note` as a plain annotation, mirrored exactly here."
                                    },
                                    "original_date": {
                                        "type": "string",
                                        "description": "Backdated/late (\"deferred\") registration \u2014 the document's real original arrival date (YYYY-MM-DD), stored in `repdate`. Requires reason_delay alongside it."
                                    },
                                    "reason_delay": {
                                        "type": "string",
                                        "description": "Required alongside original_date \u2014 why this is being registered late. Appended to `note` as a plain annotation, same as web."
                                    }
                                },
                                "required": [
                                    "box",
                                    "subject",
                                    "classification"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Use this with GET /protocol-documents/{id}."
                                                },
                                                "display_number": {
                                                    "type": "string",
                                                    "description": "The newly assigned protocol number."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/protocol-mezzi": {
            "get": {
                "summary": "List the real \"means of transmission\" options for a Protocol registration",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "mezzi": {
                                                    "type": "array",
                                                    "description": "Every selectable transmission means.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "var": {
                                                                "type": "string",
                                                                "description": "The value to send as a registration's `q_mezzo`."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "Human-readable label."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/protocol-index-entries": {
            "get": {
                "summary": "List Entry Index templates for auto-filling a Protocol registration",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "entries": {
                                                    "type": "array",
                                                    "description": "Matching templates.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "classification_var": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Matches a protocol-classifications specific option's own `var`."
                                                            },
                                                            "rpa_dep": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "rpa_user": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "rpa_name": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "visibility": {
                                                                "type": "integer"
                                                            },
                                                            "keywords": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "notes": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "mezzo": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "cc": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "dep": {
                                                                            "type": "string"
                                                                        },
                                                                        "user": {
                                                                            "type": "string"
                                                                        },
                                                                        "name": {
                                                                            "type": "string",
                                                                            "nullable": true,
                                                                            "description": "Resolved display name for `user`, when set."
                                                                        },
                                                                        "whole_uor": {
                                                                            "type": "boolean"
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                            "retention_policy": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "enum": [
                                                                    "1_year",
                                                                    "2_years",
                                                                    "5_years",
                                                                    "10_years",
                                                                    "permanent"
                                                                ],
                                                                "description": "Mapped from the template's own configured retention period."
                                                            },
                                                            "retention_action": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "enum": [
                                                                    "migrate",
                                                                    "delete"
                                                                ]
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/protocol-manageable-uors": {
            "get": {
                "summary": "List the UORs the caller can register a document \"on behalf of\"",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "uors": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "code": {
                                                                "type": "string"
                                                            },
                                                            "title": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "is_primary": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                },
                                                "primary": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "has_storage_endpoint": {
                                                    "type": "boolean",
                                                    "description": "Whether the tenant has a real cold-storage endpoint configured \u2014 a retention policy asking to migrate there is silently coerced to delete-on-expiry when this is false."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/protocol-structure-people": {
            "get": {
                "summary": "List who's assignable as RPA/CC within a given structure",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "structure",
                        "in": "query",
                        "required": false,
                        "description": "A real department acronym. Required.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Optional first/last-name filter.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "structure": {
                                                    "type": "object"
                                                },
                                                "people": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "personal_code": {
                                                                "type": "integer"
                                                            },
                                                            "first_name": {
                                                                "type": "string"
                                                            },
                                                            "last_name": {
                                                                "type": "string"
                                                            },
                                                            "photo_url": {
                                                                "type": "string"
                                                            },
                                                            "structure_acronym": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "is_protocol_enabled": {
                                                                "type": "boolean"
                                                            },
                                                            "is_head_of_unit": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/acl-structures": {
            "get": {
                "summary": "Live authorization directory for every structure (read-only)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Directory mode only \u2014 filters by structure acronym/title.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "acronym",
                        "in": "query",
                        "required": false,
                        "description": "Switches to detail mode for one structure (or \"__org__\").",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object"
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/acl-profiles": {
            "get": {
                "summary": "Permission profiles (roles) and their real grants (read-only)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "code",
                        "in": "query",
                        "required": false,
                        "description": "Switches to detail mode for one profile.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object"
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/digisign/certificates": {
            "get": {
                "summary": "Your digital-signature certificate status and history",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "certificates": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "status_label": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "Request Sent",
                                                                    "Active",
                                                                    "Expired",
                                                                    "Revoked",
                                                                    "Cancelled"
                                                                ]
                                                            },
                                                            "valid_from": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "valid_to": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "common_name": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    }
                                                },
                                                "has_active_certificate": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/digisign/documents": {
            "get": {
                "summary": "Your signed-documents repository",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "documents": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "signed_name": {
                                                                "type": "string"
                                                            },
                                                            "date_signed": {
                                                                "type": "string"
                                                            },
                                                            "download_id": {
                                                                "type": "integer",
                                                                "description": "Use with GET /digisign/documents/{id}/download \u2014 real, authenticated download, never a raw public URL."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove a signed document from your repository (soft delete)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/digisign/documents/{document_id}/download": {
            "get": {
                "summary": "Download a signed PDF (real, authenticated)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "string",
                                                "format": "binary",
                                                "description": "The raw PDF bytes, `Content-Disposition: attachment`."
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/digisign/otp": {
            "post": {
                "summary": "Request/resend/verify a signing OTP",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "filenames": {
                                        "type": "array",
                                        "description": "request/resend only \u2014 cosmetic context for the OTP email (what's being signed)."
                                    },
                                    "otp_code": {
                                        "type": "string",
                                        "description": "verify only \u2014 the 6-digit code."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/digisign/sign": {
            "post": {
                "summary": "Digitally sign one or more PDF files",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "certificate_id": {
                                        "type": "integer",
                                        "description": "One of your own active certificates \u2014 from GET /digisign/certificates."
                                    },
                                    "location": {
                                        "type": "string"
                                    },
                                    "reason": {
                                        "type": "string"
                                    },
                                    "files": {
                                        "type": "array",
                                        "description": "Array of {filename, file_base64} \u2014 a data: URI or bare base64 PDF, same convention as every other file-upload field in this API."
                                    }
                                },
                                "required": [
                                    "certificate_id",
                                    "files"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "signed": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "download_id": {
                                                                "type": "integer",
                                                                "description": "Use with GET /digisign/documents/{id}/download."
                                                            }
                                                        }
                                                    }
                                                },
                                                "failed": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "error": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/digisign/verify": {
            "post": {
                "summary": "Verify a signed PDF's own signature(s)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "filename": {
                                        "type": "string"
                                    },
                                    "file_base64": {
                                        "type": "string",
                                        "description": "A data: URI or bare base64 PDF."
                                    }
                                },
                                "required": [
                                    "file_base64"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "signature_count": {
                                                    "type": "integer"
                                                },
                                                "signers": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "signer_name": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "is_openstudio_member": {
                                                                "type": "boolean"
                                                            },
                                                            "revocation_state": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "active",
                                                                    "revoked",
                                                                    "valid",
                                                                    "unknown"
                                                                ]
                                                            },
                                                            "authority_verified": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/login": {
            "post": {
                "summary": "Log in with username/password (+ MFA if enabled)",
                "security": [],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "description": "The account's login email."
                                    },
                                    "password": {
                                        "type": "string",
                                        "description": "The account's password, in plain text over TLS \u2014 never stored or logged."
                                    }
                                },
                                "required": [
                                    "email",
                                    "password"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "success",
                                                        "mfa_required"
                                                    ],
                                                    "description": "``success``: login is complete, ``api_key`` is included. ``mfa_required``: a further verification step is needed \u2014 see ```POST /auth/login/verify```."
                                                },
                                                "api_key": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Only present when `status` is `\"success\"`. The account's personal API key \u2014 its EXISTING key if it already has one (never rotated just because of this login), or a freshly minted one if it didn't have one yet. Use this as `X-Api-User-Key` on every other request."
                                                },
                                                "profile": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Only present when `status` is `\"success\"`. Identical shape to ```GET /me```'s response."
                                                },
                                                "mfa_type": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "enum": [
                                                        "otp_app",
                                                        "otp_mail"
                                                    ],
                                                    "description": "Only present when `status` is `\"mfa_required\"`."
                                                },
                                                "challenge_token": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Only present when `status` is `\"mfa_required\"`. Opaque, expires in 5 minutes \u2014 pass it to ```POST /auth/login/verify```."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/login/verify": {
            "post": {
                "summary": "Complete login with an MFA code",
                "security": [],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "challenge_token": {
                                        "type": "string",
                                        "description": "From ```POST /auth/login```'s `mfa_required` response."
                                    },
                                    "otp_code": {
                                        "type": "string",
                                        "description": "The 6-digit emailed code (`otp_mail`) or the current code from the authenticator app (`otp_app`)."
                                    }
                                },
                                "required": [
                                    "challenge_token",
                                    "otp_code"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "success"
                                                    ],
                                                    "description": "Always ``success`` \u2014 a failed verification returns an error response instead."
                                                },
                                                "api_key": {
                                                    "type": "string",
                                                    "description": "See ```POST /auth/login```'s own `api_key` field description."
                                                },
                                                "profile": {
                                                    "type": "object",
                                                    "description": "Identical shape to ```GET /me```'s response."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/websession": {
            "post": {
                "summary": "Bridge into a real web-dashboard session for an in-app WebView",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "path": {
                                        "type": "string",
                                        "description": "A path on `client.openstudio.one` \u2014 `\"/\"`, `\"/?view={key}\"` where `{key}` matches an app's `key`/`view` from ```GET /applications``` (letters/digits/underscore/hyphen only), OR one of a small fixed set of internal-but-not-`view`-routed paths (a handful of catalog apps that render `url_type: \"external\"` on web but are genuinely internal client.openstudio.one pages, just under a different top-level route \u2014 see `web_session_bridge.php`'s `WEB_SESSION_ALLOWED_INTERNAL_PATHS`). Anything else is rejected with a ``422`` \u2014 this is an allow-list, not a sanitizer."
                                    }
                                },
                                "required": [
                                    "path"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "redeem_url": {
                                                    "type": "string",
                                                    "description": "Load this URL in the WebView \u2014 not `path` itself."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/google": {
            "post": {
                "summary": "Sign in with Google",
                "security": [],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id_token": {
                                        "type": "string",
                                        "description": "The Google ID token (a signed JWT) from the app's own Google sign-in flow."
                                    }
                                },
                                "required": [
                                    "id_token"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "success"
                                                    ],
                                                    "description": "Always ``success`` \u2014 an unlinked Google account returns an error response instead."
                                                },
                                                "api_key": {
                                                    "type": "string",
                                                    "description": "See ```POST /auth/login```'s own `api_key` field description."
                                                },
                                                "profile": {
                                                    "type": "object",
                                                    "description": "Identical shape to ```GET /me```'s response."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/passkey/register/start": {
            "post": {
                "summary": "Begin registering a passkey for the signed-in account",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "create_args": {
                                                    "type": "object",
                                                    "description": "Standard WebAuthn `PublicKeyCredentialCreationOptions`, passed unmodified to the platform's passkey-creation API."
                                                },
                                                "registration_token": {
                                                    "type": "string",
                                                    "description": "Opaque, expires in 5 minutes \u2014 pass it to ```POST /auth/passkey/register/finish``` along with the resulting credential."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/passkey/register/finish": {
            "post": {
                "summary": "Complete passkey registration",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "registration_token": {
                                        "type": "string",
                                        "description": "From ```POST /auth/passkey/register/start```."
                                    },
                                    "device_name": {
                                        "type": "string",
                                        "description": "User-supplied label, e.g. \"iPhone 17\"."
                                    },
                                    "clientDataJSON": {
                                        "type": "string",
                                        "description": "Base64url, from the native passkey-creation result."
                                    },
                                    "attestationObject": {
                                        "type": "string",
                                        "description": "Base64url, from the native passkey-creation result."
                                    }
                                },
                                "required": [
                                    "registration_token",
                                    "clientDataJSON",
                                    "attestationObject"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "success"
                                                    ],
                                                    "description": "Always ``success`` \u2014 a failed registration returns an error response instead."
                                                },
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new passkey's id \u2014 usable with ```DELETE /auth/passkey```."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/passkey/login/start": {
            "post": {
                "summary": "Begin signing in with a passkey",
                "security": [],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "get_args": {
                                                    "type": "object",
                                                    "description": "Standard WebAuthn `PublicKeyCredentialRequestOptions`, passed unmodified to the platform's passkey-assertion API."
                                                },
                                                "login_token": {
                                                    "type": "string",
                                                    "description": "Opaque, expires in 5 minutes \u2014 pass it to ```POST /auth/passkey/login/finish``` along with the resulting assertion."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/passkey/login/finish": {
            "post": {
                "summary": "Complete passkey login",
                "security": [],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "login_token": {
                                        "type": "string",
                                        "description": "From ```POST /auth/passkey/login/start```."
                                    },
                                    "clientDataJSON": {
                                        "type": "string",
                                        "description": "Base64url, from the native passkey-assertion result."
                                    },
                                    "authenticatorData": {
                                        "type": "string",
                                        "description": "Base64url, from the native passkey-assertion result."
                                    },
                                    "signature": {
                                        "type": "string",
                                        "description": "Base64url, from the native passkey-assertion result."
                                    },
                                    "rawId": {
                                        "type": "string",
                                        "description": "Base64url credential id, from the native passkey-assertion result \u2014 identifies which registered passkey was used."
                                    }
                                },
                                "required": [
                                    "login_token",
                                    "clientDataJSON",
                                    "authenticatorData",
                                    "signature",
                                    "rawId"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "success"
                                                    ],
                                                    "description": "Always ``success`` \u2014 a failed sign-in returns an error response instead."
                                                },
                                                "api_key": {
                                                    "type": "string",
                                                    "description": "See ```POST /auth/login```'s own `api_key` field description."
                                                },
                                                "profile": {
                                                    "type": "object",
                                                    "description": "Identical shape to ```GET /me```'s response."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/auth/passkey": {
            "get": {
                "summary": "List your registered passkeys",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "passkeys": {
                                                    "type": "array",
                                                    "description": "Every passkey registered on this account.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Usable with ```DELETE /auth/passkey```."
                                                            },
                                                            "device_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "User-supplied label, if one was given at registration."
                                                            },
                                                            "user_agent": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Raw value recorded at registration time \u2014 a browser user-agent string, or this app's own, depending on where the passkey was created."
                                                            },
                                                            "last_used": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "UTC timestamp (``YYYY-MM-DD HH:MM:SS``) of the last successful login with this passkey. `null` if never used to log in since registration."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "UTC timestamp (``YYYY-MM-DD HH:MM:SS``) of registration."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Revoke a passkey",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "passkey_id": {
                                        "type": "integer",
                                        "description": "The passkey to remove, from ```GET /auth/passkey```'s own list."
                                    }
                                },
                                "required": [
                                    "passkey_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {}
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/timezones": {
            "get": {
                "summary": "List every valid timezone value",
                "security": [],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "timezones": {
                                                    "type": "array",
                                                    "description": "Every valid timezone value, grouped by region.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "group_name": {
                                                                "type": "string",
                                                                "description": "Region grouping, e.g. \"Europe\"."
                                                            },
                                                            "label": {
                                                                "type": "string",
                                                                "description": "Human-readable city/zone name, e.g. \"Amsterdam\"."
                                                            },
                                                            "value": {
                                                                "type": "string",
                                                                "description": "The IANA timezone value to send, e.g. \"Europe/Amsterdam\"."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/countries": {
            "get": {
                "summary": "List every country, for a geo cascade picker",
                "security": [],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "countries": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/states": {
            "get": {
                "summary": "List a country's states/provinces, for a geo cascade picker",
                "security": [],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "country_id",
                        "in": "query",
                        "required": false,
                        "description": "A ```GET /reference/countries```' own `id`. Required.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "states": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/cities": {
            "get": {
                "summary": "List a state's cities, for a geo cascade picker",
                "security": [],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "state_id",
                        "in": "query",
                        "required": false,
                        "description": "A ```GET /reference/states```' own `id`. Required.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "cities": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/nationalities": {
            "get": {
                "summary": "List every valid nationality/citizenship value",
                "security": [],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "nationalities": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/languages": {
            "get": {
                "summary": "List every valid language value",
                "security": [],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "all",
                        "in": "query",
                        "required": false,
                        "description": "Include every locale the platform has (even partially-translated/legacy ones not offered anywhere in the product). Defaults to `false` \u2014 only languages the dashboard's own language switcher actually offers.",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "languages": {
                                                    "type": "array",
                                                    "description": "Each item has lang, language, native_name. Limited to languages actually offered in the product (matches the dashboard's own language switcher) \u2014 not every locale the platform has ever had partial translations for.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "lang": {
                                                                "type": "string",
                                                                "description": "Short code, e.g. \"en\", \"it\". This is the value consumers like ```PATCH /tenant/settings```'s `default_language` field expect."
                                                            },
                                                            "language": {
                                                                "type": "string",
                                                                "description": "English name of the language, e.g. \"Italian\"."
                                                            },
                                                            "native_name": {
                                                                "type": "string",
                                                                "description": "Language name in its own script, e.g. \"Italiano\", \"\u65e5\u672c\u8a9e\"."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/alerts": {
            "get": {
                "summary": "Active system status alerts",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "alerts": {
                                                    "type": "array",
                                                    "description": "Active system-wide status/maintenance alerts, most recent first.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "This alert's own id."
                                                            },
                                                            "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "info",
                                                                    "warning",
                                                                    "critical",
                                                                    "maintenance"
                                                                ],
                                                                "description": "How prominently this alert should be shown."
                                                            },
                                                            "title": {
                                                                "type": "string",
                                                                "description": "Short headline."
                                                            },
                                                            "message": {
                                                                "type": "string",
                                                                "description": "The full alert text."
                                                            },
                                                            "impact_scope": {
                                                                "type": "string",
                                                                "description": "e.g. \"global\" or \"minor\" \u2014 see the web status page for the full set of values."
                                                            },
                                                            "color": {
                                                                "type": "string",
                                                                "description": "A suggested UI color keyword (e.g. \"danger\", \"warning\", \"info\") \u2014 same mapping the web dashboard's own widgets use for this `type`."
                                                            },
                                                            "icon": {
                                                                "type": "string",
                                                                "description": "A suggested icon identifier (Font Awesome class name, e.g. \"fa-exclamation-triangle\") \u2014 the mobile app maps this to its own icon set rather than rendering it directly."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "UTC timestamp (``YYYY-MM-DD HH:MM:SS``)."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/service-status": {
            "get": {
                "summary": "Full platform status page",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "overall_status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "operational",
                                                        "maintenance",
                                                        "degraded",
                                                        "outage"
                                                    ],
                                                    "description": "The single worst GLOBAL-impact incident currently visible to this caller \u2014 a minor (non-global) incident never escalates this."
                                                },
                                                "checked_at": {
                                                    "type": "string",
                                                    "description": "UTC timestamp (``YYYY-MM-DD HH:MM:SS``) this response was generated at."
                                                },
                                                "groups": {
                                                    "type": "array",
                                                    "description": "Always all 6 fixed groups, even when empty (an empty `incidents` array means that group is fully operational).",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "key": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "administration",
                                                                    "data",
                                                                    "clouds",
                                                                    "benefits",
                                                                    "support",
                                                                    "other"
                                                                ],
                                                                "description": "Which part of the platform this status group covers."
                                                            },
                                                            "title": {
                                                                "type": "string",
                                                                "description": "Display title for this status group."
                                                            },
                                                            "icon": {
                                                                "type": "string",
                                                                "description": "A suggested Font Awesome icon name (no \"fa-\" prefix), e.g. \"cogs\"."
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "operational",
                                                                    "notice",
                                                                    "maintenance",
                                                                    "warning",
                                                                    "critical"
                                                                ],
                                                                "description": "\"notice\" only ever comes from a non-global (minor) incident with nothing more severe already present in the same group."
                                                            },
                                                            "color": {
                                                                "type": "string",
                                                                "description": "A suggested UI color keyword, same mapping as ```GET /alerts```'s own `color` field."
                                                            },
                                                            "incidents": {
                                                                "type": "array",
                                                                "description": "Open incidents/maintenance windows currently affecting this group, if any.",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer",
                                                                            "description": "This incident's own id."
                                                                        },
                                                                        "app_name": {
                                                                            "type": "string",
                                                                            "description": "The linked app's translated name, or \"System Infrastructure\" for an incident with no linked app."
                                                                        },
                                                                        "title": {
                                                                            "type": "string",
                                                                            "description": "Short headline."
                                                                        },
                                                                        "message": {
                                                                            "type": "string",
                                                                            "description": "The full incident text."
                                                                        },
                                                                        "type": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "info",
                                                                                "warning",
                                                                                "critical",
                                                                                "maintenance"
                                                                            ],
                                                                            "description": "How prominently this incident should be shown."
                                                                        },
                                                                        "color": {
                                                                            "type": "string",
                                                                            "description": "A hex color for a status indicator, matching this incident's own severity."
                                                                        },
                                                                        "icon": {
                                                                            "type": "string",
                                                                            "description": "An icon name for a status indicator, matching this incident's own severity."
                                                                        },
                                                                        "impact_scope": {
                                                                            "type": "string",
                                                                            "description": "e.g. \"global\" or \"minor\"."
                                                                        },
                                                                        "created_at": {
                                                                            "type": "string",
                                                                            "description": "UTC timestamp (``YYYY-MM-DD HH:MM:SS``)."
                                                                        },
                                                                        "history": {
                                                                            "type": "array",
                                                                            "description": "Timeline updates, newest first.",
                                                                            "items": {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "status_label": {
                                                                                        "type": "string",
                                                                                        "description": "Human-readable status for this group as a whole (e.g. ``Operational``, ``Degraded``)."
                                                                                    },
                                                                                    "message": {
                                                                                        "type": "string",
                                                                                        "description": "A one-line summary of this group's current status."
                                                                                    },
                                                                                    "created_at": {
                                                                                        "type": "string",
                                                                                        "description": "UTC timestamp (``YYYY-MM-DD HH:MM:SS``)."
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/translations": {
            "post": {
                "summary": "Get this tenant's translated UI copy for one language",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "lang": {
                                        "type": "string",
                                        "description": "ISO language code, e.g. \"en\", \"it\" -- see ```GET /reference/languages``` for the valid set. Defaults to \"en\"."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "lang": {
                                                    "type": "string",
                                                    "description": "The language actually returned (after sanitization) -- echoes back `lang`, or `\"en\"` if it was omitted/invalid."
                                                },
                                                "strings": {
                                                    "type": "object",
                                                    "description": "variable -> content dictionary. Most values are strings; a few are objects (multi-value translations) -- see this endpoint's own description."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reference/categories": {
            "get": {
                "summary": "List categories of USERS for queue-routing rules (not app/ticket categories)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "categories": {
                                                    "type": "array",
                                                    "description": "Every selectable category.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "code": {
                                                                "type": "string",
                                                                "description": "The value to send as a rule's `categories:<code>` value."
                                                            },
                                                            "title": {
                                                                "type": "string",
                                                                "description": "Human-readable category name."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tenant/settings": {
            "get": {
                "summary": "Get tenant general settings",
                "security": [
                    {
                        "TenantKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "website": {
                                                    "type": "string",
                                                    "x-editable": true,
                                                    "description": "The organization's public website URL."
                                                },
                                                "logo": {
                                                    "type": "string",
                                                    "x-editable": true,
                                                    "description": "Absolute URL to the organization's logo image."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "x-editable": true,
                                                    "description": "IANA timezone value used for the tenant, e.g. \"Europe/Amsterdam\". See ```GET /reference/timezones``` for the full list of valid values."
                                                },
                                                "restrict_access_admins_only": {
                                                    "type": "boolean",
                                                    "x-editable": true,
                                                    "description": "Whether the dashboard is restricted to admin users only."
                                                },
                                                "brand_id": {
                                                    "type": "integer",
                                                    "description": "The unique numeric ID for this tenant/organization."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "The organization's display name."
                                                },
                                                "subdomain": {
                                                    "type": "string",
                                                    "description": "The subdomain used to reach this tenant's dashboard, e.g. \"client\" for client.openstudio.one (the default). Currently always \"client\" for every tenant \u2014 per-tenant custom subdomains are planned but not yet supported."
                                                },
                                                "brand_email": {
                                                    "type": "string",
                                                    "description": "Primary contact email for the organization."
                                                },
                                                "registration": {
                                                    "type": "string",
                                                    "description": "UTC timestamp (``YYYY-MM-DD HH:MM:SS``) of when the tenant/organization was registered on OpenStudio."
                                                },
                                                "same_as": {
                                                    "type": "array",
                                                    "description": "Other URLs for the organization (social profiles, etc.).",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "default_language": {
                                                    "type": "string",
                                                    "description": "ISO 639 language code, e.g. \"en\". See ```GET /reference/languages``` for the full list of valid values."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Update tenant general settings",
                "security": [
                    {
                        "TenantKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "website": {
                                        "type": "string",
                                        "format": "url"
                                    },
                                    "timezone": {
                                        "type": "string",
                                        "description": "IANA timezone value to set for the tenant, e.g. \"Europe/Amsterdam\". Must be one of the values returned by ```GET /reference/timezones```."
                                    },
                                    "restrict_access_admins_only": {
                                        "type": "boolean"
                                    },
                                    "logo_base64": {
                                        "type": "string",
                                        "description": "Base64-encoded image (jpg/png/gif), optionally a data: URI"
                                    }
                                },
                                "description": "All fields optional \u2014 only provided fields are updated."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "website": {
                                                    "type": "string",
                                                    "description": "Only present if provided."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "description": "IANA timezone value now set for the tenant, e.g. \"Europe/Amsterdam\". Only present if provided."
                                                },
                                                "restrict_access_admins_only": {
                                                    "type": "boolean",
                                                    "description": "Only present if provided."
                                                },
                                                "logo": {
                                                    "type": "string",
                                                    "description": "The saved logo URL. Only present if provided."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tenant/profile": {
            "get": {
                "summary": "Tenant identity \u2014 name, logo, structure/role naming",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "The tenant's display name."
                                                },
                                                "logo_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "The tenant's uploaded logo. Null if none has been uploaded (Settings \u2192 General)."
                                                },
                                                "labels": {
                                                    "type": "object",
                                                    "description": "Each tenant can rename structure levels and responsible-role titles (ACP \u2192 Structures & Hierarchy) \u2014 use these instead of hardcoding \"Area\"/\"Department\"/\"Unit\". Always all 9 keys, falling back to the system default English name for any key the tenant hasn't customized.",
                                                    "properties": {
                                                        "l1": {
                                                            "type": "string",
                                                            "description": "Level 1 structure name, singular. Default \"Area\"."
                                                        },
                                                        "l1p": {
                                                            "type": "string",
                                                            "description": "Level 1 structure name, plural. Default \"Areas\"."
                                                        },
                                                        "l2": {
                                                            "type": "string",
                                                            "description": "Level 2 structure name, singular. Default \"Department\"."
                                                        },
                                                        "l2p": {
                                                            "type": "string",
                                                            "description": "Level 2 structure name, plural. Default \"Departments\"."
                                                        },
                                                        "l3": {
                                                            "type": "string",
                                                            "description": "Level 3 structure name, singular. Default \"Unit\"."
                                                        },
                                                        "l3p": {
                                                            "type": "string",
                                                            "description": "Level 3 structure name, plural. Default \"Units\"."
                                                        },
                                                        "rl1": {
                                                            "type": "string",
                                                            "description": "Level 1 responsible-role title. Default \"Area Manager\"."
                                                        },
                                                        "rl2": {
                                                            "type": "string",
                                                            "description": "Level 2 responsible-role title. Default \"Department Leader\"."
                                                        },
                                                        "rl3": {
                                                            "type": "string",
                                                            "description": "Level 3 responsible-role title. Default \"Unit Lead\"."
                                                        }
                                                    }
                                                },
                                                "tone": {
                                                    "type": "object",
                                                    "description": "The tenant's admin-level greeting-tone default/lock (Settings \u2192 Experience) \u2014 a caller also needs the CALLER's own `users.tone_style` (```GET /me```) to fully resolve which tone actually applies; the priority is: locked ? admin_tone : (the caller's own tone_style, else admin_tone, else \"default\").",
                                                    "properties": {
                                                        "admin_tone": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The tenant's configured default tone: \"default\", \"friendly\", \"motivational\", or \"custom:{id}\" (a tenant-authored tone \u2014 its per-time-slot text isn't exposed by this API). Null if never configured."
                                                        },
                                                        "admin_locked": {
                                                            "type": "boolean",
                                                            "description": "When true, every member sees `admin_tone` regardless of their own preference."
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/departments": {
            "post": {
                "summary": "Create a new structure (Area, Department, or Unit)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "level": {
                                        "type": "integer",
                                        "description": "1 (Area), 2 (Department), or 3 (Unit)."
                                    },
                                    "title": {
                                        "type": "string",
                                        "description": "The new structure's display name."
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "The short code \u2014 auto-uppercased, spaces stripped. Must be unique in the tenant."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "A longer, free-text description of what this structure covers."
                                    },
                                    "parent_acronym": {
                                        "type": "string",
                                        "description": "Required for level 2 or 3 \u2014 the direct parent structure's acronym, one level up."
                                    },
                                    "leader_user_id": {
                                        "type": "integer",
                                        "description": "Defaults to a tenant-level fallback if omitted."
                                    }
                                },
                                "required": [
                                    "level",
                                    "title",
                                    "name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "department": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "summary": "List organizational structures (Areas, Departments, Units)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "filter[level]",
                        "in": "query",
                        "required": false,
                        "description": "Filter by structure level.",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                1,
                                2,
                                3
                            ],
                            "x-enum-descriptions": {
                                "1": "Area",
                                "2": "Department",
                                "3": "Unit"
                            }
                        }
                    },
                    {
                        "name": "filter[parent_name]",
                        "in": "query",
                        "required": false,
                        "description": "Filter by the direct parent structure's code.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "filter[acronym]",
                        "in": "query",
                        "required": false,
                        "description": "Return only the department matching this exact acronym.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "filter[title][like]",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on the department's title.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "Comma-separated sort fields: id, level, acronym, title, created_at, updated_at. Prefix with - for descending, e.g. sort=-created_at. See the \"Filtering & sorting\" guide.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, starting at 1. Defaults to 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Rows per page, 1-200. Defaults to 50.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "departments": {
                                                    "type": "array",
                                                    "description": "Array of department objects, ordered by creation order within the tenant.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Tenant-scoped structure ID (stable, used in dashboard URLs)."
                                                            },
                                                            "acronym": {
                                                                "type": "string",
                                                                "description": "Short uppercase identifier, e.g. \"ADMIN\". Immutable after creation."
                                                            },
                                                            "title": {
                                                                "type": "string",
                                                                "description": "Full display name."
                                                            },
                                                            "description": {
                                                                "type": "string",
                                                                "description": "Free-text description. May be empty."
                                                            },
                                                            "level": {
                                                                "type": "integer",
                                                                "description": "Structure level.",
                                                                "enum": [
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "1": "Area",
                                                                    "2": "Department",
                                                                    "3": "Unit"
                                                                }
                                                            },
                                                            "area": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The top-level Area code this structure belongs to. Null for L1 Areas themselves."
                                                            },
                                                            "area_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of `area`, resolved server-side so it's available even if that Area itself isn't in this caller's own visible list (`scope: \"own\"`). Null exactly when `area` is null."
                                                            },
                                                            "parent_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Direct parent structure code. Null only for L1 Areas."
                                                            },
                                                            "parent_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of `parent_name`, resolved server-side for the same reason as `area_title`. Null exactly when `parent_name` is null."
                                                            },
                                                            "leader_user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The account id of the structure's leader/manager, if assigned."
                                                            },
                                                            "member_count": {
                                                                "type": "integer",
                                                                "description": "Distinct active members of this structure AND every structure beneath it (same \"active\" definition as ```GET /users/{id}/memberships```: until IS NULL OR until >= today) \u2014 an Area's count includes everyone assigned to one of its Departments/Units, not just people assigned directly to the Area itself. Someone assigned at more than one level in the same lineage is only counted once."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "Creation timestamp, ``YYYY-MM-DD HH:MM:SS``."
                                                            },
                                                            "updated_at": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Last update timestamp. Null if never updated since creation."
                                                            }
                                                        }
                                                    }
                                                },
                                                "scope": {
                                                    "type": "string",
                                                    "enum": [
                                                        "full",
                                                        "own"
                                                    ],
                                                    "description": "`full` if the caller (founder or any `manage_personal` tier > 0) sees every structure in the tenant; `own` if the list was narrowed to structures they lead, co-manage, or hold an active membership in."
                                                },
                                                "general_director": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "The tenant's current General Director, if one resolves (an active `departments_directors` row, or the tenant's founder as a fallback). Null if neither exists. Tenant name/logo/structure-level labels moved to their own ```GET /tenant/profile``` \u2014 see that route.",
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer",
                                                            "description": "The user currently holding this role \u2014 either an explicit appointment, or the tenant's founder via the fallback."
                                                        },
                                                        "username": {
                                                            "type": "string",
                                                            "description": "Login username \u2014 always present, regardless of privacy mode (see `display_name`)."
                                                        },
                                                        "display_name": {
                                                            "type": "string",
                                                            "description": "The name to actually show in UI. Real first+last name from the person's identity data when available and they're not in privacy mode; falls back to `username` otherwise."
                                                        },
                                                        "avatar_url": {
                                                            "type": "string",
                                                            "description": "Always a real, loadable URL \u2014 a shared blank-avatar placeholder when there's no real photo on file, or when the person is in privacy mode."
                                                        },
                                                        "from_date": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Null when resolved via the founder fallback (no formal appointment record)."
                                                        },
                                                        "appointed_by_user_id": {
                                                            "type": "integer",
                                                            "nullable": true,
                                                            "description": "The id of whoever made the appointment. Null via the founder fallback, or if the appointment itself never recorded one."
                                                        },
                                                        "is_interim": {
                                                            "type": "boolean",
                                                            "description": "True when resolved via the founder fallback rather than an explicit `departments_directors` appointment."
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/departments/{id}": {
            "patch": {
                "summary": "Edit a structure's title, description, or leader",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "The structure's new display name."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "A longer, free-text description of what this structure covers."
                                    },
                                    "leader_user_id": {
                                        "type": "integer",
                                        "description": "The structure's new leader, by user id."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "department": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a structure \u2014 only when it is currently empty",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/departments/{acronym}/members": {
            "get": {
                "summary": "Real name/photo for a structure's leader and active members",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, starting at 1. Defaults to 1. Applies to `members` only.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Rows per page, 1-200. Defaults to 50.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "department": {
                                                    "type": "object",
                                                    "description": "The structure this route was called for, echoed back for convenience.",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Tenant-scoped structure ID."
                                                        },
                                                        "acronym": {
                                                            "type": "string",
                                                            "description": "Short uppercase identifier \u2014 the same value passed in the URL."
                                                        },
                                                        "title": {
                                                            "type": "string",
                                                            "description": "Full display name."
                                                        }
                                                    }
                                                },
                                                "leader": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Null if the structure has no leader assigned. Not paginated \u2014 a structure has at most one.",
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer",
                                                            "description": "Matches the leader's `user_id` on ``GET /departments``."
                                                        },
                                                        "username": {
                                                            "type": "string",
                                                            "description": "Login username \u2014 always present, regardless of privacy mode (see `display_name`)."
                                                        },
                                                        "display_name": {
                                                            "type": "string",
                                                            "description": "The name to actually show in UI. Real first+last name from the person's identity data when available and they're not in privacy mode; falls back to `username` otherwise (privacy mode, or no identity data on file yet)."
                                                        },
                                                        "avatar_url": {
                                                            "type": "string",
                                                            "description": "Always a real, loadable URL \u2014 a shared blank-avatar placeholder when there's no real photo on file, or when the person is in privacy mode (their real photo, if any, is withheld the same way their real name is)."
                                                        }
                                                    }
                                                },
                                                "members": {
                                                    "type": "array",
                                                    "description": "Everyone with an active (non-expired) membership in this structure, primary members first, then by user id.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer",
                                                                "description": "Usable with ``GET /users/{id}`` if the caller separately has `manage_personal` access."
                                                            },
                                                            "username": {
                                                                "type": "string",
                                                                "description": "Login username \u2014 always present, regardless of privacy mode (see `display_name`)."
                                                            },
                                                            "display_name": {
                                                                "type": "string",
                                                                "description": "The name to actually show in UI. Real first+last name from the person's identity data when available and they're not in privacy mode; falls back to `username` otherwise (privacy mode, or no identity data on file yet)."
                                                            },
                                                            "avatar_url": {
                                                                "type": "string",
                                                                "description": "Always a real, loadable URL \u2014 a shared blank-avatar placeholder when there's no real photo on file, or when the person is in privacy mode."
                                                            },
                                                            "is_primary": {
                                                                "type": "boolean",
                                                                "description": "Whether this structure is the member's PRIMARY assignment \u2014 see the `/me` memberships list for the same flag from the member's own point of view."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/directory": {
            "get": {
                "summary": "Find a colleague \u2014 search the tenant's user directory",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Combined name/username search term, minimum 2 characters. Required unless `structure`, `q_name`, `q_surname`, `q_email`, or `q_number` is given instead.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_name",
                        "in": "query",
                        "required": false,
                        "description": "First-name-only search (separate from `q`, matches `address_book.php`'s own `q_name` field). Combinable with `q`/`q_surname`/others.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_surname",
                        "in": "query",
                        "required": false,
                        "description": "Last-name-only search (separate from `q`, matches `address_book.php`'s own `q_surname` field).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "structure",
                        "in": "query",
                        "required": false,
                        "description": "Restrict results to active members of this structure acronym (matches ```GET /departments```' own `acronym`).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "include_sub",
                        "in": "query",
                        "required": false,
                        "description": "With `structure`, also include that structure's sub-departments/units (one/two levels down).",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "include_leaders",
                        "in": "query",
                        "required": false,
                        "description": "With `structure`, also include that structure's leader even if they are not formally an active member of it.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "duty",
                        "in": "query",
                        "required": false,
                        "description": "Filter by organizational role: `dept_leader` (leads any department/unit) or `area_head` (leads an area). Matches `address_book.php`'s own duty filter (FIX #21).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_email",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against work contact records of type email (`contacts.data`).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_number",
                        "in": "query",
                        "required": false,
                        "description": "Substring match against work contact records of type phone/extension (`contacts.data`).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_type",
                        "in": "query",
                        "required": false,
                        "description": "Restrict `q_email`/`q_number` matching (or standalone) to one contact-channel type, e.g. `business_email`, `telephone_short`, `service_phone`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, starting at 1. Defaults to 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Rows per page, 1-50. Defaults to 20.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "results": {
                                                    "type": "array",
                                                    "description": "Matching users, same shape as the top-level fields of ```GET /directory/{id}``` (no memberships/staff_details \u2014 fetch those separately per result if the caller taps into one).",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "username": {
                                                                "type": "string"
                                                            },
                                                            "display_name": {
                                                                "type": "string"
                                                            },
                                                            "avatar_url": {
                                                                "type": "string"
                                                            },
                                                            "primary_structure_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The person's primary active structure, if any \u2014 included specifically to disambiguate homonyms in a results list without opening each profile."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/directory/{id}": {
            "get": {
                "summary": "Clickable-profile view of another user",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "user_id": {
                                                    "type": "integer",
                                                    "description": "The user's unique numeric ID."
                                                },
                                                "username": {
                                                    "type": "string",
                                                    "description": "Login username \u2014 always present, regardless of privacy mode (see `display_name`)."
                                                },
                                                "display_name": {
                                                    "type": "string",
                                                    "description": "The name to actually show in UI. Real first+last name when available and the person isn't in privacy mode; falls back to `username` otherwise."
                                                },
                                                "avatar_url": {
                                                    "type": "string",
                                                    "description": "Always a real, loadable URL \u2014 a shared blank-avatar placeholder when there's no real photo on file, or when the person is in privacy mode."
                                                },
                                                "memberships": {
                                                    "type": "array",
                                                    "description": "Currently active organizational structure assignments, primary first \u2014 identical shape to ```GET /users/{id}/memberships```.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "This assignment's own id. ``null`` if this row exists ONLY because the person leads or manages this structure without actually being a member of it (`is_leader`/`is_manager`) \u2014 there's no `departments_users` row to reference in that case."
                                                            },
                                                            "structure_acronym": {
                                                                "type": "string",
                                                                "description": "Matches the `acronym` field on ```GET /departments```."
                                                            },
                                                            "structure_title": {
                                                                "type": "string",
                                                                "description": "Full display name of the structure."
                                                            },
                                                            "level": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "1": "Area",
                                                                    "2": "Department",
                                                                    "3": "Unit"
                                                                },
                                                                "description": "Structure level."
                                                            },
                                                            "parent_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of the structure's immediate parent, resolved server-side (same as `parent_title` on ```GET /departments```). Null only for an L1 Area."
                                                            },
                                                            "area_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of the structure's top-level Area (same as `area_title` on ```GET /departments```) \u2014 for an L3 Unit this differs from `parent_title` (its immediate L2 parent); for an L2 Department the two are equal. Null only for an L1 Area."
                                                            },
                                                            "is_primary": {
                                                                "type": "boolean",
                                                                "description": "At most one primary assignment per user at a time. Always `false` on a leadership-only row (no actual membership)."
                                                            },
                                                            "is_leader": {
                                                                "type": "boolean",
                                                                "description": "Whether this person is this structure's `leader` (matches `leader_user_id` on ```GET /departments```) \u2014 independent of whether they're also a member of it."
                                                            },
                                                            "is_manager": {
                                                                "type": "boolean",
                                                                "description": "Whether this person is one of this structure's co-managers \u2014 independent of whether they're also a member of it."
                                                            },
                                                            "since": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "When this assignment started. ``null`` on a leadership-only row."
                                                            },
                                                            "until": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "``null`` = open-ended (also always ``null`` on a leadership-only row)."
                                                            },
                                                            "notes": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Free-text note attached when this assignment was created, if any."
                                                            }
                                                        }
                                                    }
                                                },
                                                "staff_details": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Present only when the CALLER is a `STRUCTURED_USERS` member or founder. ``null`` for every other caller \u2014 its absence of data, not the target's, so a ``null`` here says nothing about the target themselves.",
                                                    "properties": {
                                                        "email": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The target's account email."
                                                        },
                                                        "phone_number": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Work phone, if on file."
                                                        },
                                                        "mobile_number": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Work mobile, if on file."
                                                        },
                                                        "contact_channels": {
                                                            "type": "array",
                                                            "description": "Every other active, visible contact entry on file for this person (institutional email, internal extension, service mobile, fax, ...) \u2014 a person can have several of the same `type` (e.g. two internal extensions in different structures), so this is a list alongside (not a replacement for) `email`/`phone_number`/`mobile_number` above.",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "type": {
                                                                        "type": "string",
                                                                        "description": "Internal channel type key, e.g. `business_email`, `telephone_short`, `service_phone`, `fax`."
                                                                    },
                                                                    "label": {
                                                                        "type": "string",
                                                                        "description": "Human-readable label for `type`, already translated/humanized server-side."
                                                                    },
                                                                    "value": {
                                                                        "type": "string",
                                                                        "description": "The actual email address, phone number, or extension."
                                                                    },
                                                                    "structure": {
                                                                        "type": "string",
                                                                        "nullable": true,
                                                                        "description": "The structure acronym this specific entry is scoped to, if any (e.g. a department-specific extension). Null for a person-level entry not tied to any one structure."
                                                                    }
                                                                }
                                                            }
                                                        },
                                                        "director": {
                                                            "type": "object",
                                                            "nullable": true,
                                                            "description": "Present only if the TARGET currently holds the tenant's General Director role \u2014 same shape as `/me`'s own `director` field.",
                                                            "properties": {
                                                                "role": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "general_director"
                                                                    ]
                                                                },
                                                                "from_date": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                },
                                                                "to_date": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "Always ``null`` \u2014 only the current directorship is ever represented here."
                                                                },
                                                                "appointed_by_user_id": {
                                                                    "type": "integer",
                                                                    "nullable": true
                                                                },
                                                                "is_interim": {
                                                                    "type": "boolean"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me": {
            "get": {
                "summary": "Get current user profile and tenant context",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "users": {
                                                    "type": "object",
                                                    "description": "The basic account \u2014 login identity, status, connected sign-in providers.",
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer",
                                                            "description": "The unique user ID."
                                                        },
                                                        "brand_id": {
                                                            "type": "integer",
                                                            "description": "The unique ID of the user's tenant/organization."
                                                        },
                                                        "brand_name": {
                                                            "type": "string",
                                                            "description": "Organization display name."
                                                        },
                                                        "username": {
                                                            "type": "string",
                                                            "description": "The user's username."
                                                        },
                                                        "email": {
                                                            "type": "string",
                                                            "description": "The user's primary (login) email address."
                                                        },
                                                        "status_code": {
                                                            "type": "integer",
                                                            "description": "Account status, granular. See `status_label` for a simplified version.",
                                                            "enum": [
                                                                1,
                                                                0,
                                                                -1,
                                                                -3,
                                                                -4,
                                                                2
                                                            ],
                                                            "x-enum-descriptions": {
                                                                "1": "Active",
                                                                "0": "Inactive",
                                                                "-1": "Pending activation",
                                                                "-3": "Closed",
                                                                "-4": "Closed (undeliverable)",
                                                                "2": "Reported"
                                                            }
                                                        },
                                                        "status_label": {
                                                            "type": "string",
                                                            "description": "Simplified version of `status_code`, for consumers that don't need the distinction between the two \"closed\" reasons \u2014 both ``-3`` and ``-4`` collapse to `disabled` here. Use `status_code` if you need the granular reason.",
                                                            "enum": [
                                                                "active",
                                                                "inactive",
                                                                "pending_activation",
                                                                "disabled",
                                                                "reported"
                                                            ],
                                                            "x-enum-descriptions": {
                                                                "active": "status_code 1",
                                                                "inactive": "status_code 0",
                                                                "pending_activation": "status_code -1",
                                                                "disabled": "status_code -3 or -4",
                                                                "reported": "status_code 2"
                                                            }
                                                        },
                                                        "is_founder": {
                                                            "type": "boolean",
                                                            "description": "Whether this user is the founding admin of the organization."
                                                        },
                                                        "language": {
                                                            "type": "string",
                                                            "x-editable": true,
                                                            "description": "ISO language code (e.g., \"en\", \"it\") \u2014 matches the \"lang\" value from ```GET /reference/languages```."
                                                        },
                                                        "timezone": {
                                                            "type": "string",
                                                            "x-editable": true,
                                                            "description": "IANA timezone value for this user, e.g. \"Europe/Amsterdam\". See ```GET /reference/timezones``` for the full list of valid values."
                                                        },
                                                        "personal_code": {
                                                            "type": "integer",
                                                            "description": "Numeric identifier assigned to the user; also forms the base of sso_username."
                                                        },
                                                        "sso_id": {
                                                            "type": "string",
                                                            "description": "Active SSO identifier if present."
                                                        },
                                                        "sso_username": {
                                                            "type": "string",
                                                            "description": "The username used when authenticating via SSO, derived from personal_code."
                                                        },
                                                        "avatar_url": {
                                                            "type": "string",
                                                            "x-editable": true,
                                                            "description": "Mirrors `identity.photo_url` \u2014 always a real, loadable URL, a shared blank-avatar placeholder if no photo is on file. `identity` can be `null` (no identity record at all); this field still resolves to the placeholder in that case, never blank. Editable via PATCH as `avatar_url` \u2014 an https:// link only (no file upload through this API); an empty string clears it back to the placeholder."
                                                        },
                                                        "tone_style": {
                                                            "type": "string",
                                                            "x-editable": true,
                                                            "description": "The assistant/greeting tone preference selected by the user. Empty string means \"inherit the organization's default\" (itself `default` unless a tenant admin picked a custom one \u2014 see ```GET /tenant/settings```). ``default``/``friendly``/``motivational`` are always valid; a tenant can also define its own custom tones (staff-configured), which appear here as ``custom:{id}``, where `id` refers to a live, non-deleted custom tone on this tenant. Rejected via PATCH with a ``422`` if the organization has locked tone selection (ACP \u2192 Experience \u2192 \"Lock tone for everyone\").",
                                                            "enum": [
                                                                "",
                                                                "default",
                                                                "friendly",
                                                                "motivational"
                                                            ],
                                                            "x-enum-descriptions": {
                                                                "": "Inherit organization default",
                                                                "default": "Default tone",
                                                                "friendly": "Friendly",
                                                                "motivational": "Motivational"
                                                            }
                                                        },
                                                        "mfa": {
                                                            "type": "object",
                                                            "description": "Multi-factor authentication status.",
                                                            "properties": {
                                                                "enabled": {
                                                                    "type": "boolean",
                                                                    "description": "Whether multi-factor authentication is currently enabled for this user."
                                                                },
                                                                "type": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "The active MFA method. Null when `enabled` is `false`.",
                                                                    "enum": [
                                                                        "otp_mail",
                                                                        "otp_app"
                                                                    ],
                                                                    "x-enum-descriptions": {
                                                                        "otp_mail": "One-time code by email",
                                                                        "otp_app": "TOTP authenticator app"
                                                                    }
                                                                }
                                                            }
                                                        },
                                                        "connected_accounts": {
                                                            "type": "object",
                                                            "description": "Boolean flags indicating linked third-party providers.",
                                                            "properties": {
                                                                "facebook": {
                                                                    "type": "boolean",
                                                                    "description": "Whether a Facebook account is linked for sign-in."
                                                                },
                                                                "google": {
                                                                    "type": "boolean",
                                                                    "description": "Whether a Google account is linked for sign-in."
                                                                },
                                                                "apple": {
                                                                    "type": "boolean",
                                                                    "description": "Whether an Apple account is linked for sign-in."
                                                                },
                                                                "linkedin": {
                                                                    "type": "boolean",
                                                                    "description": "Whether a LinkedIn account is linked for sign-in."
                                                                },
                                                                "microsoft": {
                                                                    "type": "boolean",
                                                                    "description": "Whether a Microsoft account is linked for sign-in."
                                                                }
                                                            }
                                                        },
                                                        "timestamps": {
                                                            "type": "object",
                                                            "description": "Key lifecycle dates.",
                                                            "properties": {
                                                                "registered_at": {
                                                                    "type": "string",
                                                                    "description": "``YYYY-MM-DD HH:MM:SS`` \u2014 when the user account was created."
                                                                },
                                                                "last_login_at": {
                                                                    "type": "string",
                                                                    "description": "Timestamp of the user's most recent successful login."
                                                                },
                                                                "last_activity_at": {
                                                                    "type": "string",
                                                                    "description": "Timestamp of the user's most recent recorded activity in the dashboard."
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "identity": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "The \"digital identity\" extension of the basic account \u2014 personal/HR data beyond login credentials. ``null`` if this user has no identity record at all (e.g. a not-yet-recognized or externally-provisioned account).",
                                                    "properties": {
                                                        "first_name": {
                                                            "type": "string",
                                                            "description": "Your first name."
                                                        },
                                                        "middle_name": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Your middle name(s), if any."
                                                        },
                                                        "last_name": {
                                                            "type": "string",
                                                            "description": "Your last name."
                                                        },
                                                        "is_privacy_mode": {
                                                            "type": "boolean",
                                                            "description": "True when this account was created with \"privacy mode\" and no real identity data has been entered since \u2014 `first_name`/`last_name`/`sex`/`birth_date`/etc. above are all placeholder values (e.g. `first_name` equals the account's username, `sex` is `O`, `birth_date` is `01/01/1970`), not this person's real information. Automatically clears to `false` the moment real identity data is saved, whichever app does it (this API's own ```PATCH /users/{id}/identity``` included). For accounts created before this flag existed, it's derived from the same placeholder pattern rather than a stored value \u2014 still accurate, just not backed by an explicit flag on those specific rows."
                                                        },
                                                        "photo_url": {
                                                            "type": "string",
                                                            "description": "Absolute URL to the current profile photo. Falls back to a blank-avatar placeholder image (never ``null``) if no photo has ever been set \u2014 the same placeholder the dashboard itself shows."
                                                        },
                                                        "pending_photo_url": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "A newly-uploaded photo awaiting approval, if any \u2014 see ```POST /users/{id}/photo```/```POST /users/{id}/photo/approve```. ``null`` when there's no pending upload; does NOT replace `photo_url` (the live photo) until approved."
                                                        },
                                                        "sex": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "``M``/``F``/``O``, if recorded."
                                                        },
                                                        "birth_date": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Format ``DD/MM/YYYY`` \u2014 deliberately NOT the ``YYYY-MM-DD`` format used everywhere else in this API, to avoid silently reformatting the source value."
                                                        },
                                                        "birth_state": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Your birth country, if recorded."
                                                        },
                                                        "birth_province": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Your birth state/province, if recorded."
                                                        },
                                                        "birth_city": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Your birth city, if recorded."
                                                        },
                                                        "citizenship": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Your citizenship, if recorded."
                                                        },
                                                        "citizenship_other": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Free text, used when `citizenship` doesn't cover the actual value (e.g. dual/other citizenship not in the standard list)."
                                                        },
                                                        "tax_code": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "National tax identification code (e.g. Italian codice fiscale)."
                                                        },
                                                        "recognition_status": {
                                                            "type": "string",
                                                            "enum": [
                                                                "recognized",
                                                                "recognized_paper",
                                                                "not_recognized"
                                                            ],
                                                            "x-enum-descriptions": {
                                                                "recognized": "Identity verified, with a digital ID document on file.",
                                                                "recognized_paper": "Identity verified against a physical/paper document \u2014 no digital document on file.",
                                                                "not_recognized": "Identity not yet verified."
                                                            },
                                                            "description": "The same 3-state verification status the dashboard itself shows on a person's record."
                                                        },
                                                        "recognition_date": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "``null`` when `recognition_status` is ``not_recognized``."
                                                        },
                                                        "recognition_by_name": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Real name of whoever performed the recognition. ``null`` when not recognized."
                                                        },
                                                        "recognition_notes": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Free-text notes left at recognition time, if any."
                                                        },
                                                        "recognition_document": {
                                                            "type": "object",
                                                            "nullable": true,
                                                            "description": "The document used as proof, only present for document-based recognition (`recognition_status: \"recognized\"`).",
                                                            "properties": {
                                                                "type": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                },
                                                                "number": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                },
                                                                "issued_on": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                },
                                                                "file_url": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                }
                                                            }
                                                        },
                                                        "phone_number": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Landline."
                                                        },
                                                        "mobile_number": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Your mobile number, if recorded."
                                                        },
                                                        "fax_number": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Your fax number, if recorded."
                                                        },
                                                        "home_address": {
                                                            "type": "object",
                                                            "description": "Every field nullable independently \u2014 a partially-filled address is common (e.g. city known, street not).",
                                                            "properties": {
                                                                "country": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "Your home country, if recorded."
                                                                },
                                                                "district": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "State/province/region, depending on the country."
                                                                },
                                                                "city": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "Your home city, if recorded."
                                                                },
                                                                "address_type": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "e.g. `VIA` (street) \u2014 free text, not a fixed enum."
                                                                },
                                                                "address": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "Street name."
                                                                },
                                                                "number": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "Street/house number."
                                                                },
                                                                "postcode": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "Your home postcode, if recorded."
                                                                },
                                                                "co": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "\"Care of\" \u2014 an additional name on the address (e.g. a family member's surname), when the address isn't solely in the user's own name."
                                                                },
                                                                "since": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "description": "When the user started living at this address. Format `YYYY-MM-DD`."
                                                                }
                                                            }
                                                        }
                                                    }
                                                },
                                                "memberships": {
                                                    "type": "array",
                                                    "description": "Currently active organizational structure assignments, primary first. \"Active\" means not yet ended: `until` is ``null`` (open-ended) OR still in the future (a fixed-term assignment that hasn't lapsed) \u2014 same rule the dashboard's own Membership Management app uses. Ended assignments are not included here \u2014 see ```GET /users/{id}/memberships/history```. This is the same array ```GET /users/{id}/memberships``` returns on its own, wrapped under a `memberships` key there instead of nested in this larger payload.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "This assignment's own id \u2014 use this in ```PATCH /users/{id}/memberships/{membership_id}```, ```DELETE /users/{id}/memberships/{membership_id}```, and ```POST /users/{id}/memberships/{membership_id}/primary```. ``null`` on a leadership-only row (no actual membership \u2014 see `is_leader`/`is_manager`)."
                                                            },
                                                            "structure_acronym": {
                                                                "type": "string",
                                                                "description": "Matches the `acronym` field on ```GET /departments```."
                                                            },
                                                            "structure_title": {
                                                                "type": "string",
                                                                "description": "Your primary structure's display name."
                                                            },
                                                            "level": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "1": "Area",
                                                                    "2": "Department",
                                                                    "3": "Unit"
                                                                },
                                                                "description": "Your primary structure's level in the hierarchy."
                                                            },
                                                            "parent_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of the structure's immediate parent, resolved server-side. Null only for an L1 Area."
                                                            },
                                                            "area_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of the structure's top-level Area \u2014 differs from `parent_title` for an L3 Unit, equal to it for an L2 Department. Null only for an L1 Area."
                                                            },
                                                            "is_primary": {
                                                                "type": "boolean",
                                                                "description": "At most one primary assignment per user at a time. Always `false` on a leadership-only row."
                                                            },
                                                            "is_leader": {
                                                                "type": "boolean",
                                                                "description": "Whether this person is this structure's `leader`, independent of whether they're also a member of it."
                                                            },
                                                            "is_manager": {
                                                                "type": "boolean",
                                                                "description": "Whether this person is one of this structure's co-managers, independent of whether they're also a member of it."
                                                            },
                                                            "since": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "When this assignment started. Format `YYYY-MM-DD`. A small number of rows migrated from before this API existed may show a full ``YYYY-MM-DD HH:MM:SS`` timestamp instead \u2014 returned exactly as stored, never reformatted. ``null`` on a leadership-only row."
                                                            },
                                                            "until": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "``null`` = open-ended. A future date = a fixed-term assignment, still active as of now. Format `YYYY-MM-DD` when set. Also always ``null`` on a leadership-only row."
                                                            },
                                                            "notes": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Free-text note attached when this assignment was created, if any."
                                                            }
                                                        }
                                                    }
                                                },
                                                "director": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Present ONLY when this user currently holds the tenant's General Director role. ``null`` for everyone else.",
                                                    "properties": {
                                                        "role": {
                                                            "type": "string",
                                                            "enum": [
                                                                "general_director"
                                                            ],
                                                            "description": "Always this one value today."
                                                        },
                                                        "from_date": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "``null`` only when `is_interim` is ``true`` (no formal appointment record exists at all). Returned exactly as stored on the appointment record \u2014 this API has no write endpoint for director appointments, so unlike `since`/`until` above there's no validation step here to guarantee a single consistent format."
                                                        },
                                                        "to_date": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Always ``null`` \u2014 this field is only ever populated for a PAST directorship, and this object only ever represents the CURRENT one."
                                                        },
                                                        "appointed_by_user_id": {
                                                            "type": "integer",
                                                            "nullable": true,
                                                            "description": "``null`` when `is_interim` is ``true``, or when the appointment record itself has no appointing-user value."
                                                        },
                                                        "is_interim": {
                                                            "type": "boolean",
                                                            "description": "``true`` when no formal appointment record exists for this tenant at all, and this user holds the role only via the documented fallback (the founder acts as director by default until one is formally appointed)."
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Update your own timezone, language, tone style, and avatar",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "timezone": {
                                    "type": "string",
                                    "required": false,
                                    "description": "Must be a value from ```GET /reference/timezones```, or rejected with a ``422``."
                                },
                                "language": {
                                    "type": "string",
                                    "required": false,
                                    "description": "Must be an available value from ```GET /reference/languages```, or rejected with a ``422``."
                                },
                                "tone_style": {
                                    "type": "string",
                                    "required": false,
                                    "description": "One of ``''``/`default`/`friendly`/`motivational`/`custom:{id}` (a live custom tone on this tenant). Rejected with a ``422`` if the organization has locked tone selection."
                                },
                                "avatar_url": {
                                    "type": "string",
                                    "required": false,
                                    "description": "An https:// URL, or an empty string to clear it back to the blank-avatar placeholder. Rejected with a ``422`` if neither."
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object",
                                                "description": "Identical shape to ```GET /me```'s response \u2014 see that entry for the full field-by-field schema."
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notifications": {
            "get": {
                "summary": "List the caller's own notifications",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, starting at 1. Defaults to 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Rows per page, 1-100. Defaults to 20.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "items": {
                                                    "type": "array",
                                                    "description": "This page's notifications.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "read": {
                                                                "type": "boolean"
                                                            },
                                                            "date": {
                                                                "type": "string",
                                                                "description": "``YYYY-MM-DD HH:MM:SS``."
                                                            },
                                                            "icon": {
                                                                "type": "string",
                                                                "description": "A Font Awesome icon name (e.g. ``check-circle``), as used by the web dashboard's own notification rendering \u2014 not necessarily a valid icon name in a native client's own icon set."
                                                            },
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "content": {
                                                                "type": "string"
                                                            },
                                                            "action_url": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Always an absolute, directly-loadable URL \u2014 a bare relative link as stored (e.g. ``?view=home``, meaningful only relative to the web dashboard's own page) is expanded against ``CLIENT_URL`` first, unlike the web dropdown's own client-side fixup, which only handles a malformed ``http//`` prefix. ``null`` if the notification has no action at all."
                                                            },
                                                            "action_view": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "`action_url`'s ``view`` query parameter alone, pulled out so a native client can map known values to an in-app screen instead of always falling back to a web view. ``null`` if `action_url` is ``null`` or has no ``view`` parameter."
                                                            }
                                                        }
                                                    }
                                                },
                                                "unread_count": {
                                                    "type": "integer",
                                                    "description": "Total unread notifications for this caller, independent of pagination."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notifications/{id}": {
            "patch": {
                "summary": "Mark a notification as read or unread",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "read": {
                                        "type": "boolean",
                                        "description": "``true`` to mark it read, ``false`` to mark it unread."
                                    }
                                },
                                "required": [
                                    "read"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "read": {
                                                    "type": "boolean"
                                                },
                                                "date": {
                                                    "type": "string"
                                                },
                                                "icon": {
                                                    "type": "string"
                                                },
                                                "title": {
                                                    "type": "string"
                                                },
                                                "content": {
                                                    "type": "string"
                                                },
                                                "action_url": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "action_view": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a notification",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {}
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/todos": {
            "get": {
                "summary": "List the caller's own personal to-do items",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "items": {
                                                    "type": "array",
                                                    "description": "Every to-do item belonging to the caller.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "due_date": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "``YYYY-MM-DD``, or ``null`` if unset."
                                                            },
                                                            "starred": {
                                                                "type": "boolean",
                                                                "description": "The web widget's own star-icon toggle \u2014 a plain flag, not a priority scale."
                                                            },
                                                            "done": {
                                                                "type": "boolean"
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "``YYYY-MM-DD HH:MM:SS``."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Create a to-do item",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "The to-do's title."
                                    },
                                    "due_date": {
                                        "type": "string",
                                        "description": "``YYYY-MM-DD``. Omit for no due date."
                                    }
                                },
                                "required": [
                                    "title"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "title": {
                                                    "type": "string"
                                                },
                                                "due_date": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "starred": {
                                                    "type": "boolean",
                                                    "description": "Always `false` on creation."
                                                },
                                                "done": {
                                                    "type": "boolean"
                                                },
                                                "created_at": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/todos/{id}": {
            "patch": {
                "summary": "Update a to-do item, and/or toggle it done/starred",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "A new title for the to-do."
                                    },
                                    "due_date": {
                                        "type": "string",
                                        "nullable": true,
                                        "description": "``YYYY-MM-DD``, or ``null``/empty string to clear it."
                                    },
                                    "starred": {
                                        "type": "boolean",
                                        "description": "The web widget's own star-icon toggle \u2014 a plain flag, not a priority scale."
                                    },
                                    "done": {
                                        "type": "boolean",
                                        "description": "Whether the to-do is marked done."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "title": {
                                                    "type": "string"
                                                },
                                                "due_date": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "starred": {
                                                    "type": "boolean"
                                                },
                                                "done": {
                                                    "type": "boolean"
                                                },
                                                "created_at": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a to-do item",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {}
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notes": {
            "get": {
                "summary": "Get the caller's personal notepad content",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "content": {
                                                    "type": "string",
                                                    "description": "Empty string if the caller has never saved anything yet."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Replace the caller's personal notepad content",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "content": {
                                        "type": "string",
                                        "description": "The full new content. Send an empty string to clear it."
                                    }
                                },
                                "required": [
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "content": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/intranet/home": {
            "get": {
                "summary": "Intranet home \u2014 greeting, latest news, new colleagues",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "news": {
                                                    "type": "array",
                                                    "description": "Up to 3 latest news cards.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "summary": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "category": {
                                                                "type": "string"
                                                            },
                                                            "is_pinned": {
                                                                "type": "boolean"
                                                            },
                                                            "has_poll": {
                                                                "type": "boolean"
                                                            },
                                                            "has_read": {
                                                                "type": "boolean",
                                                                "description": "Whether the caller has already opened this article."
                                                            },
                                                            "unique_readers": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "reply_count": {
                                                                "type": "integer"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "new_colleagues": {
                                                    "type": "array",
                                                    "description": "Recently-joined people, matching the web widget's own recency window.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "display_name": {
                                                                "type": "string"
                                                            },
                                                            "avatar_url": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "structure": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/intranet/news": {
            "get": {
                "summary": "List/search intranet news",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on title/summary/content.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "archive",
                        "in": "query",
                        "required": false,
                        "description": "Widens the date window and page size to the full archive, instead of just the latest items.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to 9 (feed) or 20 (archive).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "items": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "display_id": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "headline": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "summary": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "category": {
                                                                "type": "string"
                                                            },
                                                            "is_pinned": {
                                                                "type": "boolean"
                                                            },
                                                            "author_name": {
                                                                "type": "string"
                                                            },
                                                            "views": {
                                                                "type": "integer"
                                                            },
                                                            "reply_count": {
                                                                "type": "integer"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/intranet/news/{id}": {
            "get": {
                "summary": "Get one news article, with reactions/poll/comments/related updates",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "title": {
                                                    "type": "string"
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "description": "Rich-text HTML, rendered via the same FormattedHtml component ticket comments use."
                                                },
                                                "hashtags": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "author_name": {
                                                    "type": "string"
                                                },
                                                "author_structure": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "reactions": {
                                                    "type": "object",
                                                    "properties": {
                                                        "totals": {
                                                            "type": "object",
                                                            "description": "Per-reaction-type counts, e.g. ``{\"like\": 4, \"love\": 1}``."
                                                        },
                                                        "total": {
                                                            "type": "integer"
                                                        },
                                                        "my_reaction": {
                                                            "type": "string",
                                                            "nullable": true
                                                        }
                                                    }
                                                },
                                                "poll": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Absent when the article has no poll."
                                                },
                                                "comments": {
                                                    "type": "array"
                                                },
                                                "related": {
                                                    "type": "array",
                                                    "description": "Other recent news items, for the \"Related updates\" section."
                                                },
                                                "allow_comments": {
                                                    "type": "boolean"
                                                },
                                                "can_post_comments": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/intranet/news/{id}/reaction": {
            "post": {
                "summary": "Set or clear the caller's reaction on a news article",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "One of ``like``/``love``/``haha``/``wow``/``sad``/``angry``, or an empty string to remove the caller's reaction."
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/intranet/news/{id}/poll-vote": {
            "post": {
                "summary": "Vote (or cancel a vote) on a news article's poll",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "option_index": {
                                        "type": "integer",
                                        "description": "A poll option's 0-based index, or ``-1`` to cancel the caller's existing vote (only when the poll allows cancellation)."
                                    }
                                },
                                "required": [
                                    "option_index"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/intranet/news/{id}/comments": {
            "post": {
                "summary": "Post a comment (or a flat reply) on a news article",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "content": {
                                        "type": "string"
                                    },
                                    "parent_id": {
                                        "type": "integer",
                                        "description": "An existing top-level comment's id, to mark this as a reply to it."
                                    }
                                },
                                "required": [
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/intranet/comments/{id}": {
            "patch": {
                "summary": "Edit a comment the caller authored (or any comment, for a moderator)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "content": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "success": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a comment the caller authored (or any comment, for a moderator)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {}
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/suggestions": {
            "get": {
                "summary": "List feature suggestions",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "tab",
                        "in": "query",
                        "required": false,
                        "description": "``active`` (default, excludes released/rejected), ``released``, or ``mine``.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "description": "One of: ``Development of a new app``, ``Design & Interface``, ``Upgrading an existing app``, ``Others``.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "``votes`` (default) or ``newest``.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "show_rejected",
                        "in": "query",
                        "required": false,
                        "description": "Only relevant on ``tab=active``; includes rejected suggestions when true.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on title/description/tags.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "1-50. Defaults to 20.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "items": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "description": {
                                                                "type": "string"
                                                            },
                                                            "category": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "integer",
                                                                "description": "-1 rejected, 0 pending, 1 approved, 2 evaluating, 3 in development, 4 released."
                                                            },
                                                            "status_label": {
                                                                "type": "string"
                                                            },
                                                            "votes": {
                                                                "type": "integer"
                                                            },
                                                            "has_voted": {
                                                                "type": "boolean",
                                                                "description": "Whether the caller has voted for this suggestion."
                                                            },
                                                            "icon_url": {
                                                                "type": "string"
                                                            },
                                                            "is_anonymous": {
                                                                "type": "boolean"
                                                            },
                                                            "is_private": {
                                                                "type": "boolean"
                                                            },
                                                            "hidden": {
                                                                "type": "boolean"
                                                            },
                                                            "tags": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "feedback": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Official response from the moderating team, if any."
                                                            },
                                                            "author_user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The author's `user_id` (SAME id space as ```GET /me```'s own `users.user_id`) \u2014 ``null`` under the exact same anonymity rule as `author_name`."
                                                            },
                                                            "author_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "``null`` when the suggestion is anonymous and the caller isn't its author or a manager."
                                                            },
                                                            "is_own": {
                                                                "type": "boolean"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "can_manage": {
                                                    "type": "boolean",
                                                    "description": "Whether the caller can PATCH suggestions / delete comments."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Submit a new feature suggestion",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "A short headline for the suggestion."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "The full suggestion text."
                                    },
                                    "category": {
                                        "type": "string",
                                        "description": "Defaults to ``Others``."
                                    },
                                    "is_anonymous": {
                                        "type": "boolean",
                                        "description": "Hide the author's identity from other users \u2014 moderators can still see it."
                                    },
                                    "is_private": {
                                        "type": "boolean",
                                        "description": "Visible only to the author and managers."
                                    }
                                },
                                "required": [
                                    "title",
                                    "description"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/suggestions/{id}": {
            "get": {
                "summary": "Get a suggestion's full detail, including comments",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "comments": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "author_user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The commenter's `user_id` (SAME id space as ```GET /me```'s own `users.user_id`). ``null`` only if resolution failed."
                                                            },
                                                            "author_name": {
                                                                "type": "string"
                                                            },
                                                            "is_manager_author": {
                                                                "type": "boolean"
                                                            },
                                                            "comment": {
                                                                "type": "string"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Edit a suggestion (managers only)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "A new headline for the suggestion."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "New full suggestion text."
                                    },
                                    "status": {
                                        "type": "integer",
                                        "description": "A new status, moderator-only."
                                    },
                                    "feedback": {
                                        "type": "string",
                                        "description": "Official feedback shown alongside the suggestion, moderator-only."
                                    },
                                    "tags": {
                                        "type": "array",
                                        "description": "Array of strings, joined and stored comma-separated."
                                    },
                                    "hidden": {
                                        "type": "boolean",
                                        "description": "Hide the suggestion from public listings, moderator-only."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {}
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/suggestions/{id}/vote": {
            "post": {
                "summary": "Toggle the caller's own vote on a suggestion",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "votes": {
                                                    "type": "integer"
                                                },
                                                "voted": {
                                                    "type": "boolean",
                                                    "description": "The caller's new vote state."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/suggestions/{id}/comments": {
            "post": {
                "summary": "Post a comment on a suggestion",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "comment": {
                                        "type": "string",
                                        "description": "The comment text."
                                    }
                                },
                                "required": [
                                    "comment"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "comment": {
                                                    "type": "string"
                                                },
                                                "author_user_id": {
                                                    "type": "integer",
                                                    "nullable": true,
                                                    "description": "Your own `user_id` (SAME id space as ```GET /me```'s own `users.user_id`)."
                                                },
                                                "author_name": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "is_manager": {
                                                    "type": "boolean"
                                                },
                                                "created_at": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/suggestions/{id}/comments/{comment_id}": {
            "delete": {
                "summary": "Delete a comment (managers only)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {}
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notification-center": {
            "get": {
                "summary": "Search for a person to view/manage notifications for",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q_name",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on first name.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_surname",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on last name.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_taxcode",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on tax code.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_personal_code",
                        "in": "query",
                        "required": false,
                        "description": "Exact match on personal code.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "1-200. Defaults to 50.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "people": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "personal_code": {
                                                                "type": "integer"
                                                            },
                                                            "user_id": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "first_name": {
                                                                "type": "string"
                                                            },
                                                            "last_name": {
                                                                "type": "string"
                                                            },
                                                            "taxcode": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "photo_url": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    }
                                                },
                                                "can_send": {
                                                    "type": "boolean",
                                                    "description": "Whether the caller may also send a manual notification (a separate, stricter permission than searching/viewing)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notification-center/{personal_code}": {
            "get": {
                "summary": "Get one person's identity summary plus their full notification history",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "person": {
                                                    "type": "object"
                                                },
                                                "can_send": {
                                                    "type": "boolean"
                                                },
                                                "notifications": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            },
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "content": {
                                                                "type": "string"
                                                            },
                                                            "icon": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "action_url": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "origin": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "read": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notification-center/{personal_code}/notifications": {
            "post": {
                "summary": "Send a manual notification to a person",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "A short headline for the manual notification."
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "The notification's full text."
                                    },
                                    "icon": {
                                        "type": "string",
                                        "description": "A Font Awesome icon name (no ``fa-`` prefix). Defaults to ``bullhorn``."
                                    },
                                    "action_url": {
                                        "type": "string",
                                        "description": "Where tapping the notification should go. Defaults to ``/?view=home``."
                                    }
                                },
                                "required": [
                                    "title",
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "sent": {
                                                    "type": "boolean"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/contact-points/{userId}": {
            "get": {
                "summary": "List one person's contact points (phone/email records)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "person": {
                                                    "type": "object"
                                                },
                                                "permission_level": {
                                                    "type": "string",
                                                    "description": "One of: ``full``, ``limited``."
                                                },
                                                "contact_points": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "type": {
                                                                "type": "string",
                                                                "description": "One of: ``telephone_short``, ``service_phone``, ``business_email``, ``functional_email``, ``fax``, ``other_internal_phone``."
                                                            },
                                                            "type_label": {
                                                                "type": "string"
                                                            },
                                                            "data": {
                                                                "type": "string"
                                                            },
                                                            "structure": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "active": {
                                                                "type": "boolean"
                                                            },
                                                            "visible": {
                                                                "type": "boolean"
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "modified_at": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "modified_by_name": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Add a new contact point for a person",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "One of: ``telephone_short``, ``service_phone``, ``business_email``, ``functional_email``, ``fax``, ``other_internal_phone``."
                                    },
                                    "data": {
                                        "type": "string",
                                        "description": "The phone number or email address."
                                    },
                                    "structure": {
                                        "type": "string",
                                        "description": "Required for every type except ``business_email`` (auto-assigned)."
                                    },
                                    "visible": {
                                        "type": "boolean",
                                        "description": "Defaults to false."
                                    }
                                },
                                "required": [
                                    "type",
                                    "data"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "contact_points": {
                                                    "type": "array"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/contact-points/{userId}/{contactId}": {
            "patch": {
                "summary": "Edit, activate/deactivate, or toggle visibility of one contact point",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "active": {
                                        "type": "boolean",
                                        "description": "Reactivate (``true``) or deactivate (``false``) this contact point."
                                    },
                                    "visible": {
                                        "type": "boolean",
                                        "description": "Show (``true``) or hide (``false``) this contact point from others."
                                    },
                                    "data": {
                                        "type": "string",
                                        "description": "The new contact value (phone number or email address)."
                                    },
                                    "structure": {
                                        "type": "string",
                                        "description": "The structure this contact point belongs to \u2014 not settable for an institutional email, which is always auto-assigned."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "contact_points": {
                                                    "type": "array"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mailboxes/me": {
            "get": {
                "summary": "Your own mailbox view (verified/business emails and mailing-list roles)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "person": {
                                                    "type": "object"
                                                },
                                                "structure": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "emails": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "type": {
                                                                "type": "string"
                                                            },
                                                            "address": {
                                                                "type": "string"
                                                            },
                                                            "verified": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                },
                                                "mailing_lists": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "code": {
                                                                "type": "string"
                                                            },
                                                            "description": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "address": {
                                                                "type": "string"
                                                            },
                                                            "is_sender": {
                                                                "type": "boolean"
                                                            },
                                                            "is_recipient": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                },
                                                "can_manage": {
                                                    "type": "boolean",
                                                    "description": "Whether you (founder or the aunicamail_manage permission) may also view someone else's mailbox via GET /mailboxes/search and GET /mailboxes/{personal_code}."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mailboxes/search": {
            "get": {
                "summary": "Search for a person, to view someone else's mailbox (manage mode)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q_personal_code",
                        "in": "query",
                        "required": false,
                        "description": "Exact match.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "q_taxcode",
                        "in": "query",
                        "required": false,
                        "description": "Substring match.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_surname",
                        "in": "query",
                        "required": false,
                        "description": "Substring match.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "people": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "personal_code": {
                                                                "type": "integer"
                                                            },
                                                            "first_name": {
                                                                "type": "string"
                                                            },
                                                            "last_name": {
                                                                "type": "string"
                                                            },
                                                            "taxcode": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "recognized": {
                                                                "type": "boolean"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mailboxes/{personal_code}": {
            "get": {
                "summary": "Another person's mailbox view (manage mode)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "person": {
                                                    "type": "object"
                                                },
                                                "structure": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "emails": {
                                                    "type": "array"
                                                },
                                                "mailing_lists": {
                                                    "type": "array"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users": {
            "get": {
                "summary": "List/search other users",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "q_name",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on first name.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_surname",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on last name.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_taxcode",
                        "in": "query",
                        "required": false,
                        "description": "Substring match on tax code.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_personal_code",
                        "in": "query",
                        "required": false,
                        "description": "Exact match on `personal_code`.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "q_username",
                        "in": "query",
                        "required": false,
                        "description": "Exact match on `username`. No match -> zero results, same as any other filter here (never silently ignored).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q_structure",
                        "in": "query",
                        "required": false,
                        "description": "A structure `acronym` (see ```GET /departments```) \u2014 matches anyone with an active membership in it, or (with `include_leaders`) anyone who leads it. `AND`'d with every other filter above, same as any of them.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "include_leaders",
                        "in": "query",
                        "required": false,
                        "description": "Only meaningful together with `q_structure`. When set, also matches this structure's leader (```GET /departments```' `leader_user_id`) even if they hold no membership row for it at all.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "include_sub",
                        "in": "query",
                        "required": false,
                        "description": "Only meaningful together with `q_structure`. When set, also matches every structure nested underneath it (children and grandchildren \u2014 structures in this API are never nested more than 3 levels deep, so this always covers the full subtree).",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "unassigned",
                        "in": "query",
                        "required": false,
                        "description": "Lists only users with ZERO currently-active structure assignments. Deliberately exclusive with every other filter on this list \u2014 set this and every other param is ignored, matching the source dashboard's own search form (checking \"unassigned only\" there clears and disables the rest of the search).",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "expand",
                        "in": "query",
                        "required": false,
                        "description": "Set to `memberships` to inline each user's active `memberships` array directly in this response (one extra query for the whole page, not one per user) \u2014 avoids a follow-up ```GET /users/{id}/memberships``` per row. Omit for the lighter default shape (no `memberships` key at all).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, starting at 1. Defaults to 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Rows per page, 1-200. Defaults to 50.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "users": {
                                                    "type": "array",
                                                    "description": "All query params are optional \u2014 omit every one to list everyone on the account, paginated, rather than requiring a search term. Requires `manage_personal` permission (any non-zero tier) or founder \u2014 403 otherwise, the same access level the dashboard itself checks before letting you reach this data at all.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer",
                                                                "description": "Use this in ```GET /users/{id}```."
                                                            },
                                                            "personal_code": {
                                                                "type": "integer",
                                                                "description": "A secondary numeric identifier \u2014 shown for reference only; `user_id` is what every other cross-reference in this API uses."
                                                            },
                                                            "first_name": {
                                                                "type": "string",
                                                                "description": "Matches on the person's first name."
                                                            },
                                                            "last_name": {
                                                                "type": "string",
                                                                "description": "Matches on the person's last name."
                                                            },
                                                            "photo_url": {
                                                                "type": "string",
                                                                "description": "Same blank-avatar placeholder fallback as `identity.photo_url` under ```GET /me``` \u2014 never ``null``."
                                                            },
                                                            "username": {
                                                                "type": "string",
                                                                "description": "Matches on the person's username."
                                                            },
                                                            "email": {
                                                                "type": "string",
                                                                "description": "Login email."
                                                            },
                                                            "status_code": {
                                                                "type": "integer",
                                                                "description": "Account status \u2014 same values as the `status_code` field under ```GET /me```'s `users` section.",
                                                                "enum": [
                                                                    1,
                                                                    0,
                                                                    -1,
                                                                    -3,
                                                                    -4,
                                                                    2
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "1": "Active",
                                                                    "0": "Inactive",
                                                                    "-1": "Pending activation",
                                                                    "-3": "Closed",
                                                                    "-4": "Closed (undeliverable)",
                                                                    "2": "Reported"
                                                                }
                                                            },
                                                            "status_label": {
                                                                "type": "string",
                                                                "description": "Simplified version of `status_code` \u2014 same collapsing rule as the `status_label` field under ```GET /me```'s `users` section (``-3``/``-4`` both become `disabled`).",
                                                                "enum": [
                                                                    "active",
                                                                    "inactive",
                                                                    "pending_activation",
                                                                    "disabled",
                                                                    "reported"
                                                                ]
                                                            },
                                                            "primary_structure_acronym": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "This person's current primary organizational structure, if they have one. Matches the `acronym` field on ```GET /departments```."
                                                            },
                                                            "primary_structure_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The person's primary structure's display name, if they have one."
                                                            },
                                                            "memberships": {
                                                                "type": "array",
                                                                "description": "Only present when `expand`=`memberships` was requested. Same shape as ```GET /users/{id}/memberships```'s own `memberships` array.",
                                                                "items": {
                                                                    "type": "object"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}": {
            "get": {
                "summary": "Get another user's identity/memberships/director data",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's `user_id` \u2014 the same id space as `user_id` everywhere else in this API (e.g. ```GET /users```' `user_id` field, `author_user_id`, `operator_user_id`, ...). This is NEVER the `personal_code` (a separate secondary reference number you'll see alongside `user_id` in several responses) \u2014 every `{id}`/`*_user_id` in this API always means `user_id`, with no exceptions. See the \"Identifying users\" guide section.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "required": false,
                        "description": "Comma-separated subset of `identity`, `memberships`, `director` to return \u2014 e.g. `include=identity` to fetch just one. Defaults to all 3 if omitted. Any other value is rejected with a ``422``.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "identity": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Same shape as ```GET /me```'s `identity`, PLUS `can_edit_identity` and `permission_level` (```GET /users/{id}``` only \u2014 `GET /me` has no equivalent, editing/viewing your own identity isn't gated the same way). `permission_level` is the CALLER's own access tier on this app (``full`` / ``read_only`` / ``enabled_users_only`` / ``none``), not anything about the target user. Omitted from the response entirely if excluded via `include`."
                                                },
                                                "memberships": {
                                                    "type": "array",
                                                    "description": "Same shape as ```GET /me```'s `memberships`. Omitted from the response entirely if excluded via `include`. For write access to this data, see ```GET /users/{id}/memberships``` and its sibling routes below.",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "director": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Same shape as ```GET /me```'s `director`. Omitted from the response entirely if excluded via `include`."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/identity": {
            "patch": {
                "summary": "Edit a user's identity fields (name, birth info, tax code)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "last_name": {
                                        "type": "string",
                                        "description": "Cannot be set to an empty string."
                                    },
                                    "first_name": {
                                        "type": "string",
                                        "description": "Cannot be set to an empty string."
                                    },
                                    "middle_name": {
                                        "type": "string",
                                        "description": "Send an empty string to clear it."
                                    },
                                    "sex": {
                                        "type": "string",
                                        "enum": [
                                            "M",
                                            "F",
                                            "O"
                                        ],
                                        "description": "``M``/``F``/``O``."
                                    },
                                    "birth_date": {
                                        "type": "string",
                                        "description": "Format `DD/MM/YYYY` \u2014 matches how ```GET /me```'s `identity` returns it, deliberately NOT `YYYY-MM-DD`. Validated as a real calendar date, rejected with a ``422`` otherwise."
                                    },
                                    "birth_state": {
                                        "type": "string",
                                        "description": "Birth country."
                                    },
                                    "birth_province": {
                                        "type": "string",
                                        "description": "Birth state/province."
                                    },
                                    "birth_city": {
                                        "type": "string",
                                        "description": "Birth city."
                                    },
                                    "citizenship": {
                                        "type": "string",
                                        "description": "Citizenship."
                                    },
                                    "citizenship_other": {
                                        "type": "string",
                                        "description": "Used only when ``citizenship`` is set to a value meaning \"other\" \u2014 free text."
                                    },
                                    "taxcode": {
                                        "type": "string",
                                        "description": "Cannot be set to an empty string. No format/checksum validation is applied \u2014 sent as-is once non-empty."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "first_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "middle_name": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "last_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "sex": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "birth_date": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "birth_state": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "birth_province": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "birth_city": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "citizenship": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "citizenship_other": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "tax_code": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "recognition_status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "recognized",
                                                        "recognized_paper",
                                                        "not_recognized"
                                                    ],
                                                    "description": "See ```GET /me```'s `identity`. Unaffected by an identity edit."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/recognition": {
            "post": {
                "summary": "Mark a user as identity-recognized",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "method": {
                                        "type": "string",
                                        "enum": [
                                            "manual",
                                            "document"
                                        ],
                                        "description": "`manual` records recognition against a physical/paper document (no digital file on file) \u2014 the resulting status is `recognized_paper`. `document` requires `doc_id` and results in `recognized`."
                                    },
                                    "doc_id": {
                                        "type": "integer",
                                        "description": "Required when `method` is `document`. Must already exist on file for this user \u2014 this endpoint only REFERENCES an existing document, it never uploads one (document upload isn't available via this API yet)."
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Free text, truncated to 500 characters."
                                    }
                                },
                                "required": [
                                    "method"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "first_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "last_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "recognition_status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "recognized",
                                                        "recognized_paper",
                                                        "not_recognized"
                                                    ],
                                                    "description": "See ```GET /me```'s `identity`. Reflects the outcome of this call."
                                                },
                                                "recognition_date": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/contacts": {
            "patch": {
                "summary": "Edit a user's phone numbers",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "mobile_number": {
                                        "type": "string",
                                        "description": "Send an empty string to clear it. No format validation is applied server-side."
                                    },
                                    "phone_number": {
                                        "type": "string",
                                        "description": "Send an empty string to clear it."
                                    },
                                    "fax_number": {
                                        "type": "string",
                                        "description": "Send an empty string to clear it."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "first_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "last_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "phone_number": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`. Reflects `phone_number` if it was part of this `PATCH`."
                                                },
                                                "mobile_number": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`. Reflects `mobile_number` if it was part of this `PATCH`."
                                                },
                                                "fax_number": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /me```'s `identity`. Reflects `fax_number` if it was part of this `PATCH`."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/residence": {
            "patch": {
                "summary": "Edit a user's home address",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "home_country": {
                                        "type": "string",
                                        "description": "Home country."
                                    },
                                    "home_district": {
                                        "type": "string",
                                        "description": "Home state/province."
                                    },
                                    "home_city": {
                                        "type": "string",
                                        "description": "Home city."
                                    },
                                    "home_postcode": {
                                        "type": "string",
                                        "description": "Home postcode."
                                    },
                                    "home_address": {
                                        "type": "string",
                                        "description": "Street address."
                                    },
                                    "home_address_type": {
                                        "type": "string",
                                        "description": "Free text, e.g. `\"VIA\"`."
                                    },
                                    "home_number": {
                                        "type": "string",
                                        "description": "Street number."
                                    },
                                    "home_co": {
                                        "type": "string",
                                        "description": "Care-of / additional address line."
                                    },
                                    "home_date": {
                                        "type": "string",
                                        "description": "Format `YYYY-MM-DD` \u2014 \"since\" date at this address. Unlike `identity`'s `birth_date`, this one IS a real calendar-date format. Validated, rejected with a ``422`` if not a real date."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "first_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "last_name": {
                                                    "type": "string",
                                                    "description": "See ```GET /me```'s `identity`."
                                                },
                                                "home_address": {
                                                    "type": "object",
                                                    "description": "See ```GET /me```'s `identity`' own `home_address` object \u2014 same 9 fields, reflecting whichever ones were part of this `PATCH`.",
                                                    "properties": {
                                                        "country": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Home country, if recorded."
                                                        },
                                                        "district": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Home state/province, if recorded."
                                                        },
                                                        "city": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Home city, if recorded."
                                                        },
                                                        "address_type": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "The kind of address this is (e.g. residence vs domicile), if recorded."
                                                        },
                                                        "address": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Street address, if recorded."
                                                        },
                                                        "number": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Street number, if recorded."
                                                        },
                                                        "postcode": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Postcode, if recorded."
                                                        },
                                                        "co": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Care-of / additional address line, if recorded."
                                                        },
                                                        "since": {
                                                            "type": "string",
                                                            "nullable": true,
                                                            "description": "Echoes `home_date` if it was part of this request, otherwise the existing value. Format `YYYY-MM-DD`."
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/history": {
            "get": {
                "summary": "Get a user's identity/contact/address/photo change history",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "expand",
                        "in": "query",
                        "required": false,
                        "description": "Set to `performed_by` to also inline basic details for whoever made each change, instead of just the bare `performed_by_personal_code`. One extra batch query regardless of how many history rows come back \u2014 never a lookup per row. Any other value is rejected with a ``422``.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "history": {
                                                    "type": "array",
                                                    "description": "Every recorded change across identity, recognition, contacts, residence, and photo edits for this user, newest first \u2014 a different table/scope from ```GET /users/{id}/memberships/history```, which only covers structure assignments.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "field": {
                                                                "type": "string",
                                                                "description": "Which field changed, e.g. `taxcode`, `mobile_number`, `home_city`, `recognition_status`, `picture`."
                                                            },
                                                            "old_value": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The field's value before this change, if applicable."
                                                            },
                                                            "new_value": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The field's value after this change."
                                                            },
                                                            "performed_by_personal_code": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The identifier of whoever made this change. See `?expand=performed_by` for a resolved version instead of this bare id."
                                                            },
                                                            "performed_by": {
                                                                "type": "object",
                                                                "nullable": true,
                                                                "description": "Only present when `?expand=performed_by` was requested. ``null`` if `performed_by_personal_code` itself was ``null``, or didn't resolve to a record on this tenant.",
                                                                "properties": {
                                                                    "user_id": {
                                                                        "type": "integer",
                                                                        "description": "The same `user_id` used everywhere else in this API \u2014 NOT `performed_by_personal_code` itself, see the \"Identifying users\" guide."
                                                                    },
                                                                    "personal_code": {
                                                                        "type": "integer",
                                                                        "description": "Same value as `performed_by_personal_code` on the row itself \u2014 included here too so this object is usable on its own without also reading the sibling field."
                                                                    },
                                                                    "first_name": {
                                                                        "type": "string",
                                                                        "description": "The person who made this change \u2014 first name."
                                                                    },
                                                                    "last_name": {
                                                                        "type": "string",
                                                                        "description": "The person who made this change \u2014 last name."
                                                                    }
                                                                }
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "When this change was recorded."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/photo": {
            "post": {
                "summary": "Upload a new profile photo (pending approval)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "photo_base64": {
                                        "type": "string",
                                        "description": "Base64-encoded image (jpg/png/gif), optionally a `data:` URI \u2014 same convenience shape as ```PATCH /tenant/settings```'s `logo_base64` field. Validated by actual file content (not just the claimed type), max 5 MB. A new upload replaces any existing PENDING upload \u2014 it does not touch the current live photo until approved."
                                    }
                                },
                                "required": [
                                    "photo_base64"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "photo_url": {
                                                    "type": "string",
                                                    "description": "The current LIVE (approved) photo, or the blank-avatar placeholder if none has ever been approved. Unchanged by this call \u2014 a fresh upload only ever affects `pending_photo_url` until approved."
                                                },
                                                "pending_photo_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "The photo just uploaded, awaiting approval via ```POST /users/{id}/photo/approve```."
                                                },
                                                "is_validated": {
                                                    "type": "boolean",
                                                    "description": "Whether `photo_url` (the live photo) has been approved. Unaffected by a new pending upload."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove the current live profile photo",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "photo_url": {
                                                    "type": "string",
                                                    "description": "Always the blank-avatar placeholder on success \u2014 this endpoint removes the live photo, it does not delete the identity record itself."
                                                },
                                                "pending_photo_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Unaffected \u2014 only the LIVE photo is removed by this call."
                                                },
                                                "is_validated": {
                                                    "type": "boolean",
                                                    "description": "Always `false` on success."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/photo/approve": {
            "post": {
                "summary": "Approve the pending photo upload, making it live",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "photo_url": {
                                                    "type": "string",
                                                    "description": "Now equal to what `pending_photo_url` was before this call."
                                                },
                                                "pending_photo_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Always ``null`` on success \u2014 the pending upload has been promoted, so there's nothing left pending."
                                                },
                                                "is_validated": {
                                                    "type": "boolean",
                                                    "description": "Always `true` on success. `404` if there was no pending upload to approve."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/photo/pending": {
            "delete": {
                "summary": "Reject the pending photo upload",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "photo_url": {
                                                    "type": "string",
                                                    "description": "Unaffected \u2014 only the PENDING upload is discarded by this call. May be the blank-avatar placeholder if no live photo was ever approved."
                                                },
                                                "pending_photo_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Always ``null`` on success. Rejecting when there was nothing pending is a harmless no-op, not an error."
                                                },
                                                "is_validated": {
                                                    "type": "boolean",
                                                    "description": "Unaffected."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/documents": {
            "get": {
                "summary": "List a user's identity documents",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "documents": {
                                                    "type": "array",
                                                    "description": "Requires full edit access to this user's data (not just view access) \u2014 matches the source dashboard app exactly, where even the document LIST sits behind the same permission as editing it, unlike identity/contacts/residence.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Use this in ```POST /users/{id}/documents/{id}/validate```, ```GET /users/{id}/documents/{id}/download```, and ```DELETE /users/{id}/documents/{id}```."
                                                            },
                                                            "type": {
                                                                "type": "string",
                                                                "description": "Free text, e.g. `\"ID CARD\"`, `\"Passport\"`, `\"Driving license\"` \u2014 not a fixed enum."
                                                            },
                                                            "authority": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Who issued the document."
                                                            },
                                                            "number": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The document's own number/code, if recorded."
                                                            },
                                                            "issued_on": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Format `DD/MM/YYYY`."
                                                            },
                                                            "expires_on": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Format `DD/MM/YYYY`."
                                                            },
                                                            "status": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    0,
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "x-enum-descriptions": [
                                                                    "Unvalidated",
                                                                    "File validated",
                                                                    "Original validated in person",
                                                                    "Fully validated (both)"
                                                                ],
                                                                "description": "How far along validation is \u2014 see the enum values above."
                                                            },
                                                            "status_label": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "unvalidated",
                                                                    "file_validated",
                                                                    "original_validated",
                                                                    "fully_validated"
                                                                ],
                                                                "description": "Lowercase name of `status`."
                                                            },
                                                            "validation": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Free-text validation record, e.g. `\"21/08/2026 (Jane Doe)\"` \u2014 ``null`` until validated at least once."
                                                            },
                                                            "used_for_recognition": {
                                                                "type": "boolean",
                                                                "description": "Whether this document was used as the basis for ```POST /users/{id}/recognition```'s `document` method."
                                                            },
                                                            "has_file": {
                                                                "type": "boolean",
                                                                "description": "Whether a file exists for this document AT ALL, via either storage mechanism \u2014 check `file_url` to tell which. `false` means there's genuinely nothing to view or download."
                                                            },
                                                            "file_url": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "A direct, public, already-downloadable URL \u2014 but ONLY for a document that predates this API's file-manager migration (uploaded via the legacy path, which stores a plain public URL instead of a file-manager id). ``null`` for a normal, file-manager-backed document (created via ```POST /users/{id}/documents```) \u2014 fetch those via ```GET /users/{id}/documents/{id}/download``` instead, which needs the usual auth header this bare URL does not carry."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "When this document record was added."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Upload a new identity document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "Free text, e.g. `\"ID CARD\"`, `\"Passport\"`."
                                    },
                                    "authority": {
                                        "type": "string",
                                        "description": "The issuing authority, if known."
                                    },
                                    "number": {
                                        "type": "string",
                                        "description": "The document's own number/code."
                                    },
                                    "issued_on": {
                                        "type": "string",
                                        "description": "Format `DD/MM/YYYY`. Validated as a real calendar date, rejected with a ``422`` otherwise."
                                    },
                                    "expires_on": {
                                        "type": "string",
                                        "description": "Format `DD/MM/YYYY`. Validated as a real calendar date, rejected with a ``422`` otherwise."
                                    },
                                    "file_base64": {
                                        "type": "string",
                                        "description": "Base64-encoded file (pdf/jpg/png), optionally a `data:` URI \u2014 same convenience shape as ```PATCH /tenant/settings```'s `logo_base64` field. Validated by actual file content, max 10 MB. Stored via the file-manager system, not returned as a raw public URL \u2014 see `has_file`/```GET /users/{id}/documents/{id}/download```."
                                    }
                                },
                                "required": [
                                    "type",
                                    "file_base64"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "See ```GET /users/{id}/documents```."
                                                },
                                                "type": {
                                                    "type": "string",
                                                    "description": "Echoes `type`."
                                                },
                                                "authority": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Echoes `authority`, or ``null`` if omitted."
                                                },
                                                "number": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Echoes `number`, or ``null`` if omitted."
                                                },
                                                "issued_on": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Echoes `issued_on`, or ``null`` if omitted."
                                                },
                                                "expires_on": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Echoes `expires_on`, or ``null`` if omitted."
                                                },
                                                "status": {
                                                    "type": "integer",
                                                    "description": "Always ``0`` on creation \u2014 a newly uploaded document is always unvalidated. Use ```POST /users/{id}/documents/{id}/validate``` afterward."
                                                },
                                                "status_label": {
                                                    "type": "string",
                                                    "description": "Always ``unvalidated`` on creation."
                                                },
                                                "validation": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Always ``null`` on creation."
                                                },
                                                "used_for_recognition": {
                                                    "type": "boolean",
                                                    "description": "Always `false` on creation."
                                                },
                                                "has_file": {
                                                    "type": "boolean",
                                                    "description": "Always `true` on creation \u2014 this endpoint requires `file_base64`."
                                                },
                                                "file_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Always `null` on creation \u2014 a document created here is always file-manager-backed, never the legacy-URL shape. See ```GET /users/{id}/documents```'s own `file_url` description."
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "description": "When this document record was added."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/documents/{document_id}": {
            "delete": {
                "summary": "Delete an unvalidated document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "document_id",
                        "in": "path",
                        "required": true,
                        "description": "One document's own id, from the `id` field of an item in ```GET /users/{id}/documents```'s `documents` array (or from the response of ```POST /users/{id}/documents```, right after uploading it).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean",
                                                    "description": "Always `true` on success. Rejected with a ``403`` if the document has already been validated at any level (`status` other than ``0``) \u2014 matches the source app's own rule exactly: only an unvalidated document can be deleted."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/documents/{document_id}/validate": {
            "post": {
                "summary": "Validate a document",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "document_id",
                        "in": "path",
                        "required": true,
                        "description": "Same id as on ```DELETE /users/{id}/documents/{document_id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "level": {
                                        "type": "string",
                                        "enum": [
                                            "file",
                                            "original",
                                            "both"
                                        ],
                                        "x-enum-descriptions": {
                                            "file": "The uploaded file has been reviewed.",
                                            "original": "The physical/original document has been checked in person.",
                                            "both": "Both of the above."
                                        },
                                        "description": "Sets `status` to ``1``, ``2``, or ``3`` respectively."
                                    }
                                },
                                "required": [
                                    "level"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "See ```GET /users/{id}/documents```."
                                                },
                                                "status": {
                                                    "type": "integer",
                                                    "enum": [
                                                        1,
                                                        2,
                                                        3
                                                    ],
                                                    "x-enum-descriptions": {
                                                        "1": "File validated",
                                                        "2": "Original validated in person",
                                                        "3": "Fully validated (both)"
                                                    },
                                                    "description": "Reflects `level` from this request."
                                                },
                                                "status_label": {
                                                    "type": "string",
                                                    "enum": [
                                                        "file_validated",
                                                        "original_validated",
                                                        "fully_validated"
                                                    ],
                                                    "description": "Lowercase name of `status`."
                                                },
                                                "validation": {
                                                    "type": "string",
                                                    "description": "The new validation record, `\"DD/MM/YYYY (Operator Name)\"` \u2014 today's date and your own name."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/documents/{document_id}/download": {
            "get": {
                "summary": "Download a document's file",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "document_id",
                        "in": "path",
                        "required": true,
                        "description": "Same id as on ```DELETE /users/{id}/documents/{document_id}```. Must be file-manager-backed (`has_file`=`true` AND `file_url`=`null` \u2014 see ```GET /users/{id}/documents```) or this returns a ``404``.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {}
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/memberships": {
            "get": {
                "summary": "List a user's active organizational structure assignments",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "memberships": {
                                                    "type": "array",
                                                    "description": "Same shape and same \"active\" definition as the `memberships` array on ```GET /me``` / ```GET /users/{id}``` \u2014 this route exists on its own specifically so the id it returns can be used with the write routes below.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "This assignment's own id \u2014 use this in ```PATCH /users/{id}/memberships/{membership_id}```, ```DELETE /users/{id}/memberships/{membership_id}```, and ```POST /users/{id}/memberships/{membership_id}/primary```. ``null`` on a leadership-only row (no actual membership \u2014 see `is_leader`/`is_manager`)."
                                                            },
                                                            "structure_acronym": {
                                                                "type": "string",
                                                                "description": "Matches the `acronym` field on ```GET /departments```."
                                                            },
                                                            "structure_title": {
                                                                "type": "string",
                                                                "description": "This structure's display name."
                                                            },
                                                            "level": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "1": "Area",
                                                                    "2": "Department",
                                                                    "3": "Unit"
                                                                },
                                                                "description": "This structure's level in the hierarchy."
                                                            },
                                                            "parent_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of the structure's immediate parent, resolved server-side. Null only for an L1 Area."
                                                            },
                                                            "area_title": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Display title of the structure's top-level Area \u2014 differs from `parent_title` for an L3 Unit, equal to it for an L2 Department. Null only for an L1 Area."
                                                            },
                                                            "is_primary": {
                                                                "type": "boolean",
                                                                "description": "At most one primary assignment per user at a time. Always `false` on a leadership-only row."
                                                            },
                                                            "is_leader": {
                                                                "type": "boolean",
                                                                "description": "Whether this person is this structure's `leader`, independent of whether they're also a member of it."
                                                            },
                                                            "is_manager": {
                                                                "type": "boolean",
                                                                "description": "Whether this person is one of this structure's co-managers, independent of whether they're also a member of it."
                                                            },
                                                            "since": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "When this assignment started. Format `YYYY-MM-DD`. A small number of rows migrated from before this API existed may show a full ``YYYY-MM-DD HH:MM:SS`` timestamp instead \u2014 returned exactly as stored, never reformatted. ``null`` on a leadership-only row."
                                                            },
                                                            "until": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "``null`` = open-ended. A future date = a fixed-term assignment, still active as of now. Format `YYYY-MM-DD` when set."
                                                            },
                                                            "notes": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Free-text note attached when this assignment was created, if any."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Assign a user to a structure",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "structure_acronym": {
                                        "type": "string",
                                        "description": "Must match an active, non-deleted structure `acronym` on this account (see ```GET /departments```) \u2014 rejected with a ``422`` otherwise. Rejected with a ``409`` if this user already has an active assignment (open-ended or still-future-dated) to this same structure."
                                    },
                                    "is_primary": {
                                        "type": "boolean",
                                        "description": "Defaults to `false`. Forced to `true` regardless of what you send if this is the user's first active assignment ever \u2014 a user can never have an active structure without exactly one being primary, so there's nothing to choose from on the very first one."
                                    },
                                    "since": {
                                        "type": "string",
                                        "description": "Format `YYYY-MM-DD`. Defaults to today if omitted."
                                    },
                                    "until": {
                                        "type": "string",
                                        "description": "Format `YYYY-MM-DD`. Open-ended (no scheduled end) if omitted. Must be strictly after `since` or this is rejected with a ``422`` \u2014 unlike some legacy behavior this migrates, an invalid `until` is never silently dropped."
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Free text, truncated to 500 characters."
                                    }
                                },
                                "required": [
                                    "structure_acronym"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new assignment's id."
                                                },
                                                "structure_acronym": {
                                                    "type": "string",
                                                    "description": "Echoes `structure_acronym`."
                                                },
                                                "structure_title": {
                                                    "type": "string",
                                                    "description": "The new structure's display name."
                                                },
                                                "level": {
                                                    "type": "integer",
                                                    "enum": [
                                                        1,
                                                        2,
                                                        3
                                                    ],
                                                    "x-enum-descriptions": {
                                                        "1": "Area",
                                                        "2": "Department",
                                                        "3": "Unit"
                                                    },
                                                    "description": "The new structure's level in the hierarchy."
                                                },
                                                "is_primary": {
                                                    "type": "boolean",
                                                    "description": "The actual value stored \u2014 may be `true` even if you sent `false` or omitted it, see `is_primary`'s own request-field description."
                                                },
                                                "since": {
                                                    "type": "string",
                                                    "description": "Echoes `since` (or today's date, if omitted). Format `YYYY-MM-DD`."
                                                },
                                                "until": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Echoes `until`, or ``null`` if omitted. Format `YYYY-MM-DD`."
                                                },
                                                "notes": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Echoes `notes`, or ``null`` if omitted."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/memberships/history": {
            "get": {
                "summary": "Get a user's membership change history",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "expand",
                        "in": "query",
                        "required": false,
                        "description": "Set to `performed_by` to also inline basic details for whoever made each change, instead of just the bare `performed_by_personal_code`. One extra batch query regardless of how many history rows come back \u2014 never a lookup per row. Any other value is rejected with a ``422``.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "history": {
                                                    "type": "array",
                                                    "description": "Every recorded structure-assignment change for this user, newest first. Empty array (not an error) if this account's membership-history feature isn't set up yet.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "event_type": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "assignment",
                                                                    "removal",
                                                                    "scheduled_end",
                                                                    "primary_change"
                                                                ],
                                                                "description": "What kind of membership event this is."
                                                            },
                                                            "event_label": {
                                                                "type": "string",
                                                                "description": "Short human-readable summary of what happened."
                                                            },
                                                            "structure_from": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Meaning depends on `event_type` \u2014 e.g. the structure being removed/ended, or the previous primary on a `primary_change`."
                                                            },
                                                            "structure_to": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Meaning depends on `event_type`, mirrors `structure_from` \u2014 e.g. the newly assigned structure, or the new primary."
                                                            },
                                                            "performed_by_personal_code": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The identifier of whoever made this change. See `?expand=performed_by` for a resolved version instead of this bare id."
                                                            },
                                                            "performed_by": {
                                                                "type": "object",
                                                                "nullable": true,
                                                                "description": "Only present when `?expand=performed_by` was requested. ``null`` if `performed_by_personal_code` itself was ``null``, or didn't resolve to a record on this tenant.",
                                                                "properties": {
                                                                    "user_id": {
                                                                        "type": "integer",
                                                                        "description": "The same `user_id` used everywhere else in this API \u2014 NOT `performed_by_personal_code` itself, see the \"Identifying users\" guide."
                                                                    },
                                                                    "personal_code": {
                                                                        "type": "integer",
                                                                        "description": "Same value as `performed_by_personal_code` on the row itself \u2014 included here too so this object is usable on its own without also reading the sibling field."
                                                                    },
                                                                    "first_name": {
                                                                        "type": "string",
                                                                        "description": "The person this event is about \u2014 first name."
                                                                    },
                                                                    "last_name": {
                                                                        "type": "string",
                                                                        "description": "The person this event is about \u2014 last name."
                                                                    }
                                                                }
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "When this change was recorded."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/memberships/roles": {
            "get": {
                "summary": "Get the structures a user leads, and whether that leadership is formalized",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "roles": {
                                                    "type": "array",
                                                    "description": "A completely different concept from `memberships` above \u2014 this is every structure where `leader` on that structure names this user directly, independent of whether they hold an active membership row for it at all.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "structure_acronym": {
                                                                "type": "string",
                                                                "description": "Matches the `acronym` field on ```GET /departments```."
                                                            },
                                                            "structure_title": {
                                                                "type": "string",
                                                                "description": "This structure's display name."
                                                            },
                                                            "level": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "1": "Area",
                                                                    "2": "Department",
                                                                    "3": "Unit"
                                                                },
                                                                "description": "This structure's level in the hierarchy."
                                                            },
                                                            "is_formalized": {
                                                                "type": "boolean",
                                                                "description": "Whether this leadership has a matching formal role record on file. `false` just means informal/unrecorded \u2014 it does not mean the leadership itself is invalid or pending."
                                                            },
                                                            "is_ad_interim": {
                                                                "type": "boolean",
                                                                "description": "`true` if the formal role is recorded as a temporary/interim appointment. Always `false` when `is_formalized` is ``false``."
                                                            },
                                                            "role_label": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Free-text description from the formal role record, if one exists. ``null`` when `is_formalized` is ``false``."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/memberships/{membership_id}": {
            "patch": {
                "summary": "End or schedule the end of a structure assignment",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "membership_id",
                        "in": "path",
                        "required": true,
                        "description": "One assignment's own id, from the `id` field of an item in ```GET /users/{id}/memberships```'s `memberships` array (or from the response of ```POST /users/{id}/memberships```, right after creating it).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "until": {
                                        "type": "string",
                                        "nullable": true,
                                        "description": "Format `YYYY-MM-DD`, or `null` to end it today. A date today or in the past ends the assignment immediately \u2014 if it was the user's primary, another active assignment is auto-promoted when there's exactly one candidate, or left unset with `needs_primary_selection: true` in the response when there are several (use ```POST /users/{id}/memberships/{membership_id}/primary``` to resolve it). A date in the future just schedules the end \u2014 the assignment (and its primary status, if any) stays active until then, nothing is reassigned yet."
                                    }
                                },
                                "required": [
                                    "until"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "membership": {
                                                    "type": "object",
                                                    "description": "Same shape as one item of ```GET /users/{id}/memberships```'s `memberships` array, reflecting the new `until` value."
                                                },
                                                "needs_primary_selection": {
                                                    "type": "boolean",
                                                    "description": "`true` only when this ended the user's primary assignment immediately AND more than one other active assignment remains \u2014 none of them is auto-promoted in that case. See `primary_candidates` below."
                                                },
                                                "primary_candidates": {
                                                    "type": "array",
                                                    "description": "Structure codes of the user's other currently-active assignments, only populated when `needs_primary_selection` is `true`.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "End a structure assignment immediately",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "membership_id",
                        "in": "path",
                        "required": true,
                        "description": "One assignment's own id, from the `id` field of an item in ```GET /users/{id}/memberships```'s `memberships` array (or from the response of ```POST /users/{id}/memberships```, right after creating it).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean",
                                                    "description": "Always `true` on success. Despite the field name (kept for the usual REST delete-response shape), nothing is removed from storage \u2014 this is a soft close, identical to ```PATCH /users/{id}/memberships/{membership_id}``` with `until` set to today: the assignment row is kept, just marked ended, so it still appears in ```GET /users/{id}/memberships/history```. Same primary-reassignment behavior applies."
                                                },
                                                "needs_primary_selection": {
                                                    "type": "boolean",
                                                    "description": "Same meaning as on ```PATCH /users/{id}/memberships/{membership_id}```."
                                                },
                                                "primary_candidates": {
                                                    "type": "array",
                                                    "description": "Same meaning as on ```PATCH /users/{id}/memberships/{membership_id}```.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/users/{id}/memberships/{membership_id}/primary": {
            "post": {
                "summary": "Switch a user's primary structure assignment",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The target user's id \u2014 same as on ```GET /users/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "membership_id",
                        "in": "path",
                        "required": true,
                        "description": "The assignment to switch to primary \u2014 same id as on ```PATCH /users/{id}/memberships/{membership_id}```. Must currently be active (not already ended) or this is rejected with a ``404``.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Echoes `{membership_id}` from the URL."
                                                },
                                                "structure_acronym": {
                                                    "type": "string",
                                                    "description": "The membership's own structure, by acronym."
                                                },
                                                "structure_title": {
                                                    "type": "string",
                                                    "description": "That structure's display name."
                                                },
                                                "level": {
                                                    "type": "integer",
                                                    "enum": [
                                                        1,
                                                        2,
                                                        3
                                                    ],
                                                    "x-enum-descriptions": {
                                                        "1": "Area",
                                                        "2": "Department",
                                                        "3": "Unit"
                                                    },
                                                    "description": "That structure's level in the hierarchy."
                                                },
                                                "is_primary": {
                                                    "type": "boolean",
                                                    "description": "Always `true` on success."
                                                },
                                                "since": {
                                                    "type": "string",
                                                    "description": "When this assignment started. Format `YYYY-MM-DD`. A small number of rows migrated from before this API existed may show a full ``YYYY-MM-DD HH:MM:SS`` timestamp instead \u2014 returned exactly as stored, never reformatted."
                                                },
                                                "until": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "``null`` = open-ended. Format `YYYY-MM-DD` when set."
                                                },
                                                "notes": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Free-text notes on why this is now the primary structure, if any were sent."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/groups": {
            "get": {
                "summary": "List the tenant's selectable authorization groups",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "groups": {
                                                    "type": "array",
                                                    "description": "Every group visible to this caller's tenant, platform-wide groups included.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "code": {
                                                                "type": "string",
                                                                "description": "The value to send as a rule's `groups:<code>` value."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "description": "Human-readable group name."
                                                            },
                                                            "is_global": {
                                                                "type": "boolean",
                                                                "description": "Whether this group is a platform-wide group available to every tenant, rather than one scoped to this tenant specifically \u2014 real feedback asked for this distinction to show in the picker, not just a bare code/name pair."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/queues": {
            "get": {
                "summary": "List support queues",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "queues": {
                                                    "type": "array",
                                                    "description": "Filtered per caller, same rule as the \"get support\" queue picker in the dashboard: founders, `manage_queues_admin` holders, and anyone who operates at least one queue see every queue; everyone else sees only queues they are eligible to submit a ticket into (`enabled_categories` empty, or a matching `structures`/`users`/`categories`/`groups` rule).",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Matches `queue_id` on ```GET /tickets```'s items."
                                                            },
                                                            "category": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "Spaces",
                                                                    "Administration - Finance - Personnel",
                                                                    "Digital Identity and Authorizations",
                                                                    "Repository and Archives",
                                                                    "Safety & Security",
                                                                    "Database",
                                                                    "Data and IT management",
                                                                    "Maintenance",
                                                                    "Other"
                                                                ],
                                                                "description": "A fixed classification label, not a hierarchical grouping."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "description": "The queue's display name."
                                                            },
                                                            "description": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "A longer description of what this queue is for."
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "visible",
                                                                    "hidden"
                                                                ],
                                                                "description": "A hidden queue still functions normally (existing tickets, replies, etc. all work) \u2014 it just doesn't surface as a destination for new submissions."
                                                            },
                                                            "recipient_structures": {
                                                                "type": "array",
                                                                "description": "Which organizational structures can OPERATE this queue's tickets \u2014 the same rule ```POST /tickets```'s `queue_id` eligibility check and this API's own operator-resolution logic both read.",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "type": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "structures"
                                                                            ],
                                                                            "description": "Only one type exists today."
                                                                        },
                                                                        "value": {
                                                                            "type": "string",
                                                                            "description": "A structure `acronym` \u2014 matches ```GET /departments```."
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                            "enabled_categories": {
                                                                "type": "array",
                                                                "description": "Who is allowed to SUBMIT a new ticket into this queue. Empty array means anyone on the account can.",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "type": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "structures",
                                                                                "groups"
                                                                            ],
                                                                            "description": "Whether this rule targets structures or authorization groups."
                                                                        },
                                                                        "value": {
                                                                            "type": "string",
                                                                            "description": "A structure or group code, matching `type`."
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                            "recipient_apps": {
                                                                "type": "array",
                                                                "description": "Which applications surface a \"get support\" link pointing at this queue.",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "type": {
                                                                            "type": "string",
                                                                            "description": "The rule's own kind \u2014 mirrors ``type`` above."
                                                                        },
                                                                        "value": {
                                                                            "type": "string",
                                                                            "description": "An application identifier."
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                            "sla_hours": {
                                                                "type": "integer",
                                                                "description": "Target resolution time, in hours. Defaults to ``72`` if never explicitly set."
                                                            },
                                                            "reopen_days_limit": {
                                                                "type": "integer",
                                                                "description": "How many days after being solved a ticket may still be reopened by its non-operator author (see ```POST /tickets/{id}/reopen```). Defaults to ``7`` if never explicitly set."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Create a support queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Max 150 characters."
                                    },
                                    "category": {
                                        "type": "string",
                                        "enum": [
                                            "Spaces",
                                            "Administration - Finance - Personnel",
                                            "Digital Identity and Authorizations",
                                            "Repository and Archives",
                                            "Safety & Security",
                                            "Database",
                                            "Data and IT management",
                                            "Maintenance",
                                            "Other"
                                        ],
                                        "description": "Which broad category this queue falls under, for grouping in the queue picker."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Max 250 characters."
                                    },
                                    "recipient_structures": {
                                        "type": "array",
                                        "description": "Same shape as the response field. Omit for none.",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "enabled_categories": {
                                        "type": "array",
                                        "description": "Same shape as the response field. Omit for \"anyone can submit.\"",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "recipient_apps": {
                                        "type": "array",
                                        "description": "Same shape as the response field. Omit for none.",
                                        "items": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "required": [
                                    "name",
                                    "category"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new queue's id."
                                                },
                                                "category": {
                                                    "type": "string",
                                                    "description": "Echoes `category`."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Echoes `name`."
                                                },
                                                "description": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Echoes `description`, or ``null`` if omitted."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "description": "Always ``visible`` on creation."
                                                },
                                                "recipient_structures": {
                                                    "type": "array",
                                                    "description": "Echoes what you sent, or an empty array.",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "enabled_categories": {
                                                    "type": "array",
                                                    "description": "Echoes what you sent, or an empty array.",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "recipient_apps": {
                                                    "type": "array",
                                                    "description": "Echoes what you sent, or an empty array.",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "sla_hours": {
                                                    "type": "integer",
                                                    "description": "Always ``72`` on creation \u2014 this endpoint has no field to set an initial SLA; use ```PATCH /queues/{id}/settings``` afterward."
                                                },
                                                "reopen_days_limit": {
                                                    "type": "integer",
                                                    "description": "Always ``7`` on creation \u2014 use ```PATCH /queues/{id}/settings``` to change it."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/queues/{id}": {
            "get": {
                "summary": "Get one support queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The queue's id, from the `id` field of an item in ```GET /queues```'s `queues` array (or from the response of ```POST /queues```, right after creating it) \u2014 the same id as `queue_id` on ```GET /tickets```' items.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "x-note-see": true
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Edit a support queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The queue's id, from the `id` field of an item in ```GET /queues```'s `queues` array (or from the response of ```POST /queues```, right after creating it) \u2014 the same id as `queue_id` on ```GET /tickets```' items.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Cannot be set to an empty string."
                                    },
                                    "category": {
                                        "type": "string",
                                        "enum": [
                                            "Spaces",
                                            "Administration - Finance - Personnel",
                                            "Digital Identity and Authorizations",
                                            "Repository and Archives",
                                            "Safety & Security",
                                            "Database",
                                            "Data and IT management",
                                            "Maintenance",
                                            "Other"
                                        ],
                                        "description": "A new category for this queue."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "A new description for this queue."
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "visible",
                                            "hidden"
                                        ],
                                        "description": "Show or hide this queue in the queue picker."
                                    },
                                    "recipient_structures": {
                                        "type": "array",
                                        "description": "Full replace, not a merge.",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "enabled_categories": {
                                        "type": "array",
                                        "description": "Full replace, not a merge.",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "recipient_apps": {
                                        "type": "array",
                                        "description": "Full replace, not a merge.",
                                        "items": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "x-note-see": true
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a support queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The queue's id, from the `id` field of an item in ```GET /queues```'s `queues` array (or from the response of ```POST /queues```, right after creating it) \u2014 the same id as `queue_id` on ```GET /tickets```' items.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean",
                                                    "description": "Always `true` on success. A soft delete \u2014 tickets already in this queue are untouched and remain reachable individually; the queue just stops appearing in ```GET /queues```."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/queues/{id}/settings": {
            "patch": {
                "summary": "Edit a queue's SLA, reopen window, and notification rules",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The queue's id \u2014 same as on ```GET /queues/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "sla_hours": {
                                        "type": "integer",
                                        "description": "Must be a positive integer."
                                    },
                                    "reopen_days_limit": {
                                        "type": "integer",
                                        "description": "Must be zero or a positive integer."
                                    },
                                    "notifications": {
                                        "type": "object",
                                        "description": "Keyed by trigger type: `new_ticket`, `new_reply`, `status_change`, `reopened`, `assignment`, `queue_transfer`, `paused`, `resumed`. Each value is an object with `notify_author`/`notify_operators`/`notify_assigned`, each one of `none`/`web`/`email`/`both`. Only the trigger types you include are changed \u2014 omitted ones keep their existing rule."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "See ```GET /queues```."
                                                },
                                                "sla_hours": {
                                                    "type": "integer",
                                                    "description": "Reflects `sla_hours` if it was part of this `PATCH`."
                                                },
                                                "reopen_days_limit": {
                                                    "type": "integer",
                                                    "description": "Reflects `reopen_days_limit` if it was part of this `PATCH`."
                                                },
                                                "notifications": {
                                                    "type": "object",
                                                    "description": "Every trigger type this queue has an explicit rule for (not just the ones in this request) \u2014 same shape as the request field."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/queues/{id}/team": {
            "get": {
                "summary": "Get one structure's team roster for a queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The queue's id \u2014 same as on ```GET /queues/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "structure",
                        "in": "query",
                        "required": true,
                        "description": "A structure `acronym` \u2014 matches ```GET /departments```.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "team": {
                                                    "type": "array",
                                                    "description": "Includes the structure's leader automatically, even if they have no explicit role granted \u2014 see `implicit` below.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer",
                                                                "description": "This team member's own user id."
                                                            },
                                                            "first_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "This team member's first name."
                                                            },
                                                            "last_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "This team member's last name."
                                                            },
                                                            "roles": {
                                                                "type": "array",
                                                                "description": "One or both of `operator` (handles tickets in this queue) and `manager` (can manage this structure's team and this queue's settings \u2014 a DIFFERENT capability from `operator`, not a superset).",
                                                                "items": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "operator",
                                                                        "manager"
                                                                    ]
                                                                }
                                                            },
                                                            "implicit": {
                                                                "type": "boolean",
                                                                "description": "`true` for this structure's leader when they hold no explicit ```POST /queues/{id}/team``` row \u2014 they still always have full `operator`+`manager` rights. Cannot be removed via ```DELETE /queues/{id}/team/{user_id}```; change the structure's leader instead."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Add one operator or manager to a structure's team for a queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The queue's id \u2014 same as on ```GET /queues/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "structure": {
                                        "type": "string",
                                        "description": "A structure `acronym`."
                                    },
                                    "user_id": {
                                        "type": "integer",
                                        "description": "Must currently belong to the given `structure` (same account, same primary department) \u2014 rejected with a ``422`` otherwise."
                                    },
                                    "role": {
                                        "type": "string",
                                        "enum": [
                                            "operator",
                                            "manager"
                                        ],
                                        "description": "A user can hold both roles at once \u2014 call this twice with each role if you want that."
                                    }
                                },
                                "required": [
                                    "structure",
                                    "user_id",
                                    "role"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "x-note-see": true
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/queues/{id}/team/{user_id}": {
            "delete": {
                "summary": "Remove one operator or manager from a structure's team for a queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The queue's id \u2014 same as on ```GET /queues/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "user_id",
                        "in": "path",
                        "required": true,
                        "description": "The team member's id, from the `user_id` field of an item in ```GET /queues/{id}/team```'s `team` array. Must not be `implicit` \u2014 see that field's description.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "structure",
                        "in": "query",
                        "required": true,
                        "description": "A structure `acronym`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "role",
                        "in": "query",
                        "required": true,
                        "description": "Removes only this ONE role \u2014 a user with both `operator` and `manager` keeps the other one unless you call this twice.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "operator",
                                "manager"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "x-note-see": true
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets": {
            "get": {
                "summary": "List tickets",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "scope",
                        "in": "query",
                        "required": false,
                        "description": "Defaults to \"operator\" if you operate at least one queue, otherwise \"mine\". \"operator\" returns every ticket in a queue you operate, plus any assigned or shared with you. \"mine\" returns only tickets you personally filed, regardless of queue role. Requesting scope=operator when you don't operate any queue returns a 403.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "operator",
                                "mine"
                            ]
                        }
                    },
                    {
                        "name": "filter[status]",
                        "in": "query",
                        "required": false,
                        "description": "Filter by exact status.",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                -1,
                                0,
                                1,
                                2,
                                3
                            ],
                            "x-enum-descriptions": {
                                "-1": "Refused",
                                "0": "Draft",
                                "1": "Open",
                                "2": "Solved",
                                "3": "Paused"
                            }
                        }
                    },
                    {
                        "name": "filter[queue_id]",
                        "in": "query",
                        "required": false,
                        "description": "Filter by exact queue id.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "filter[priority]",
                        "in": "query",
                        "required": false,
                        "description": "Filter by exact priority.",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                1,
                                2,
                                3,
                                4
                            ],
                            "x-enum-descriptions": {
                                "1": "Low",
                                "2": "Medium",
                                "3": "High",
                                "4": "Critical"
                            }
                        }
                    },
                    {
                        "name": "filter[search]",
                        "in": "query",
                        "required": false,
                        "description": "Case-insensitive substring match against `subject`, `app`, and reply/comment content \u2014 combined with `OR`, then `AND`'d with every other filter on this list, same as any other filter. An internal note is only matched under `scope`=`operator` (every ticket in that scope is one you already have full operator-level access to); under `scope`=`mine`, only public replies are searched, matching the same visibility rule ```GET /tickets/{id}```'s own `comments` array already applies.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "expand",
                        "in": "query",
                        "required": false,
                        "description": "Set to `comments` to inline each ticket's `comments` array directly in this response (one extra query for the whole page, not one per ticket) \u2014 avoids a follow-up ```GET /tickets/{id}``` per row just to read replies. Same internal-note visibility rule as `filter[search]` above: included under `scope`=`operator`, public-only under `scope`=`mine`. Omit for the lighter default shape (no `comments` key at all).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "Comma-separated sort fields: id, created_at, modified_at, priority, status. Prefix a field with - for descending, e.g. sort=-created_at. Defaults to -modified_at (most recently active first).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, starting at 1. Defaults to 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Rows per page, 1-200. Defaults to 50.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "tickets": {
                                                    "type": "array",
                                                    "description": "Ordered by modified_at descending by default (see the sort query param).",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Human-facing, per-tenant sequential ticket number \u2014 the `{id}` used in every other ticket route, and what the dashboard itself shows as \"Ticket #123\". This is the ONLY ticket identifier this API ever exposes; no internal/database identifier is ever returned."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "description": "Ticket title, set at creation and changeable via ```PATCH```."
                                                            },
                                                            "status": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    -1,
                                                                    0,
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "-1": "Refused",
                                                                    "0": "Draft",
                                                                    "1": "Open",
                                                                    "2": "Solved",
                                                                    "3": "Paused"
                                                                },
                                                                "description": "A brand-new ticket starts at ``0`` (Draft) \u2014 the dashboard's own create flow immediately follows up with a status change to ``1`` (Open) in practice, but a ticket created via ```POST /tickets``` starts at ``0`` too."
                                                            },
                                                            "status_label": {
                                                                "type": "string",
                                                                "description": "Lowercase name of `status`, e.g. ``open`` \u2014 a display convenience so a caller doesn't have to hardcode the status-code-to-name mapping themselves.",
                                                                "enum": [
                                                                    "refused",
                                                                    "draft",
                                                                    "open",
                                                                    "solved",
                                                                    "paused"
                                                                ]
                                                            },
                                                            "priority": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    1,
                                                                    2,
                                                                    3,
                                                                    4
                                                                ],
                                                                "x-enum-descriptions": {
                                                                    "1": "Low",
                                                                    "2": "Medium",
                                                                    "3": "High",
                                                                    "4": "Critical"
                                                                },
                                                                "description": "Defaults to ``1`` (Low) on a new ticket. No automatic escalation \u2014 only changes when a ```PATCH``` or bulk update explicitly sets it."
                                                            },
                                                            "queue_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "``null`` for an \"orphan\" ticket \u2014 one not (or no longer) assigned to any queue."
                                                            },
                                                            "queue_name": {
                                                                "type": "string",
                                                                "description": "Nullable, mirrors `queue_id` \u2014 the queue's display name at the time of the request (not cached; always current)."
                                                            },
                                                            "app": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The application this ticket was filed from/about, if any (e.g. `helpdesk`, `manage_tickets`) \u2014 an internal app identifier, not a human-readable name. Not validated against a fixed list; any string you send on create/```PATCH``` is stored as-is."
                                                            },
                                                            "author_id": {
                                                                "type": "string",
                                                                "description": "The ticket author's identifier \u2014 a DIFFERENT id space from `user_id` elsewhere in this API (e.g. `author_user_id` on ```PATCH```, `operator_user_id` on assignments). Returned as an opaque identifier; this API has no endpoint to resolve it to a display name yet."
                                                            },
                                                            "assigned_operator_ids": {
                                                                "type": "array",
                                                                "description": "Same id space as `author_id` (not `user_id`) \u2014 the operator(s) currently assigned to work this ticket. Empty array if unassigned.",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "When the ticket was created, format ``YYYY-MM-DD HH:MM:SS`` (server time). Set once at creation \u2014 there is no way to set this yourself on create, and no endpoint ever lets you change it afterward."
                                                            },
                                                            "modified_at": {
                                                                "type": "string",
                                                                "description": "When the ticket (or any of its comments, via a reply) last changed, format ``YYYY-MM-DD HH:MM:SS`` (server time). Updated automatically by the server on every write action in this API \u2014 there is no field on any request body that sets this directly."
                                                            },
                                                            "comments": {
                                                                "type": "array",
                                                                "description": "Only present when `expand`=`comments` was requested. Same shape as ```GET /tickets/{id}```'s own `comments` array.",
                                                                "items": {
                                                                    "type": "object"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Create a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subject": {
                                        "type": "string",
                                        "description": "Ticket title."
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "The first message/description of the issue \u2014 becomes the ticket's first comment (public, not internal). Stored and returned exactly as sent \u2014 plain text or HTML both work, this API doesn't require or convert either way."
                                    },
                                    "queue_id": {
                                        "type": "integer",
                                        "description": "Must be an active (non-deleted, status=1), on-account queue, AND one you're eligible to file into per that queue's recipient rules (same structures:/users:/categories:/groups: rules the dashboard's own \"New Ticket\" form uses to build its dropdown) \u2014 UNLESS you operate at least one queue yourself, in which case eligibility isn't checked (an operator may file into any active queue on the account, matching the dashboard's own staff \"create on behalf\" flow)."
                                    },
                                    "app": {
                                        "type": "string",
                                        "description": "Optional related application code. Free text, not validated against a fixed list."
                                    },
                                    "author_user_id": {
                                        "type": "integer",
                                        "description": "Create the ticket on behalf of ANOTHER user \u2014 that user's `user_id`. Only honored when you're an operator on at least one queue; silently ignored (the ticket is created as yourself) otherwise, same as a non-operator never seeing this option in the dashboard at all. A nonexistent or cross-account id is rejected with a ``422``, never silently accepted. Note: the ticket's author becomes this user, but the first comment (your `content`) is still recorded as written by YOU, the caller \u2014 matching the dashboard's own \"create on behalf\" behavior exactly."
                                    }
                                },
                                "required": [
                                    "subject",
                                    "content",
                                    "queue_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new ticket's id (see ```GET /tickets```' `id` field)."
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "description": "Echoes the `subject` you sent."
                                                },
                                                "status": {
                                                    "type": "integer",
                                                    "description": "Always ``0`` (Draft) on creation \u2014 see the note on ```GET /tickets```' `status` field."
                                                },
                                                "status_label": {
                                                    "type": "string",
                                                    "description": "Always ``draft`` on creation."
                                                },
                                                "priority": {
                                                    "type": "integer",
                                                    "enum": [
                                                        1,
                                                        2,
                                                        3,
                                                        4
                                                    ],
                                                    "description": "Always ``1`` (Low) on creation \u2014 this endpoint has no field to set an initial priority; use ```PATCH``` afterward if needed."
                                                },
                                                "queue_id": {
                                                    "type": "integer",
                                                    "description": "Echoes the `queue_id` you sent."
                                                },
                                                "queue_name": {
                                                    "type": "string",
                                                    "description": "The queue's current display name."
                                                },
                                                "app": {
                                                    "type": "string",
                                                    "description": "Echoes the `app` you sent, or ``null`` if omitted."
                                                },
                                                "author_id": {
                                                    "type": "string",
                                                    "description": "Your own identifier \u2014 UNLESS you sent a valid `author_user_id` as an operator, in which case this identifies that user instead."
                                                },
                                                "assigned_operator_ids": {
                                                    "type": "array",
                                                    "description": "Always an empty array on creation \u2014 a brand-new ticket has no operator assigned yet.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "description": "Set by the server at creation time. Not settable by the caller."
                                                },
                                                "modified_at": {
                                                    "type": "string",
                                                    "description": "Equal to `created_at` on a freshly-created ticket. Not settable by the caller."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}": {
            "get": {
                "summary": "Get one ticket, with its comments",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id, from the `id` field of an item in ```GET /tickets```' `tickets` array (or from the response of ```POST /tickets```, right after creating it).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "See ```GET /tickets```' `id` field."
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "x-editable": true,
                                                    "description": "See ```GET /tickets```."
                                                },
                                                "status": {
                                                    "type": "integer",
                                                    "x-editable": true,
                                                    "enum": [
                                                        -1,
                                                        0,
                                                        1,
                                                        2,
                                                        3
                                                    ],
                                                    "x-enum-descriptions": {
                                                        "-1": "Refused",
                                                        "0": "Draft",
                                                        "1": "Open",
                                                        "2": "Solved",
                                                        "3": "Paused"
                                                    },
                                                    "description": "See ```GET /tickets```."
                                                },
                                                "status_label": {
                                                    "type": "string",
                                                    "enum": [
                                                        "refused",
                                                        "draft",
                                                        "open",
                                                        "solved",
                                                        "paused"
                                                    ],
                                                    "description": "See ```GET /tickets```."
                                                },
                                                "priority": {
                                                    "type": "integer",
                                                    "x-editable": true,
                                                    "enum": [
                                                        1,
                                                        2,
                                                        3,
                                                        4
                                                    ],
                                                    "x-enum-descriptions": {
                                                        "1": "Low",
                                                        "2": "Medium",
                                                        "3": "High",
                                                        "4": "Critical"
                                                    },
                                                    "description": "See ```GET /tickets```."
                                                },
                                                "queue_id": {
                                                    "type": "integer",
                                                    "x-editable": true,
                                                    "nullable": true,
                                                    "description": "See ```GET /tickets```."
                                                },
                                                "queue_name": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "See ```GET /tickets```."
                                                },
                                                "app": {
                                                    "type": "string",
                                                    "x-editable": true,
                                                    "nullable": true,
                                                    "description": "See ```GET /tickets```."
                                                },
                                                "author_id": {
                                                    "type": "string",
                                                    "description": "See ```GET /tickets```. Settable indirectly via ```PATCH```'s `author_user_id` field (a different field name \u2014 see that section)."
                                                },
                                                "assigned_operator_ids": {
                                                    "type": "array",
                                                    "description": "See ```GET /tickets```. Not directly settable here \u2014 use the assignments endpoints instead.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "description": "Set once at creation, never caller-settable. See ```GET /tickets```."
                                                },
                                                "modified_at": {
                                                    "type": "string",
                                                    "description": "Set by the server on every write, never caller-settable. See ```GET /tickets```."
                                                },
                                                "comments": {
                                                    "type": "array",
                                                    "description": "Ordered oldest first. Internal notes are only included when you're an operator on this ticket \u2014 omitted entirely for the author or a read-only share, same as the dashboard's own comment list.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "The comment's own identifier \u2014 unlike ticket ids, comments have no separate \"display id\" concept anywhere in the product, so this IS the identifier to use, e.g. in ```PATCH /tickets/{id}/comments/{comment_id}``` or `divide`'s `comment_ids`."
                                                            },
                                                            "author_id": {
                                                                "type": "string",
                                                                "description": "The commenter's identifier \u2014 a DIFFERENT id space from `user_id` elsewhere in this API."
                                                            },
                                                            "author_user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The commenter's `user_id`, in the SAME id space as ```GET /me```'s own `users.user_id`. ``null`` only if `author_id` no longer resolves to a real person."
                                                            },
                                                            "author_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The commenter's resolved display name. ``null`` if resolution failed."
                                                            },
                                                            "content": {
                                                                "type": "string",
                                                                "description": "The comment body, exactly as originally submitted (or last edited via ```PATCH /tickets/{id}/comments/{comment_id}```) \u2014 returned as-is, not sanitized or reformatted by this API. Depending on how it was posted, this can be plain text with literal newlines, or real HTML (`<p>`, `<strong>`, `<a href=\"...\">`, etc.) from the dashboard's rich-text reply editor. Render or sanitize on your end according to what you're building \u2014 don't assume either shape."
                                                            },
                                                            "is_internal": {
                                                                "type": "boolean",
                                                                "description": "``true`` for an operator-only note, never visible to the ticket's author/a read-only share (see this array's own top-level description)."
                                                            },
                                                            "is_staff": {
                                                                "type": "boolean",
                                                                "description": "``true`` if the commenter was acting as an operator on this ticket at the moment they posted \u2014 independent of `is_internal` (an operator can post a normal, public reply too)."
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "description": "When posted \u2014 updated to the edit time if the comment was later changed via ```PATCH /tickets/{id}/comments/{comment_id}``` (matches the dashboard's own behavior of re-stamping the date on edit)."
                                                            }
                                                        }
                                                    }
                                                },
                                                "parent": {
                                                    "type": "object",
                                                    "nullable": true,
                                                    "description": "Present only if THIS ticket is itself a child of another one. ``null`` otherwise.",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "The parent ticket's id."
                                                        },
                                                        "subject": {
                                                            "type": "string",
                                                            "description": "The parent ticket's subject."
                                                        }
                                                    }
                                                },
                                                "children": {
                                                    "type": "array",
                                                    "description": "Tickets created as children OF this one. A non-operator (the author, or a read-only share) only sees entries where `parent_visible` is ``true`` \u2014 an operator always sees every child regardless, same as the dashboard.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "The child ticket's id."
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "description": "The child ticket's title."
                                                            },
                                                            "status": {
                                                                "type": "integer",
                                                                "enum": [
                                                                    -1,
                                                                    0,
                                                                    1,
                                                                    2,
                                                                    3
                                                                ],
                                                                "description": "The child ticket's own status."
                                                            },
                                                            "parent_visible": {
                                                                "type": "boolean",
                                                                "description": "Whether this ticket's non-operator author is allowed to know this child exists \u2014 set when the child was created/linked, changeable via ```PATCH /tickets/{id}/children/{child_id}```."
                                                            }
                                                        }
                                                    }
                                                },
                                                "linked_ticket_ids": {
                                                    "type": "array",
                                                    "description": "Ids of tickets linked to this one via ```POST /tickets/{id}/links``` (generic, non-parent/child relations only \u2014 parent/child relations show up in `parent`/`children` instead, not here).",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "shares": {
                                                    "type": "array",
                                                    "description": "Present ONLY when you're an operator on this ticket \u2014 omitted from the response entirely for a non-operator, same as the dashboard's share panel not being shown to them at all.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "The share's own identifier \u2014 use this in ```DELETE /tickets/{id}/shares/{share_id}```."
                                                            },
                                                            "target_type": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "user",
                                                                    "queue"
                                                                ],
                                                                "description": "Whether this share was granted to one specific user or to everyone in a queue."
                                                            },
                                                            "target_id": {
                                                                "type": "integer",
                                                                "description": "The target user's or target queue's id, matching `target_type`."
                                                            },
                                                            "permission": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "read",
                                                                    "edit"
                                                                ],
                                                                "description": "The access level this share grants \u2014 note that ``edit`` alone (with `role` = ``user``) still does not make the target an operator; see `role` below."
                                                            },
                                                            "role": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "user",
                                                                    "operator"
                                                                ],
                                                                "description": "`role` = ``operator`` is what actually grants moderator-level access on this ticket via the share \u2014 `role` = ``user`` (even with `permission` = ``edit``) does not."
                                                            }
                                                        }
                                                    }
                                                },
                                                "watching": {
                                                    "type": "boolean",
                                                    "description": "Whether YOU (the authenticated caller) are currently watching this ticket \u2014 your own watch state only, not a list of every watcher."
                                                },
                                                "assigned_operators": {
                                                    "type": "array",
                                                    "description": "`assigned_operator_ids` resolved to display names, in the same order \u2014 one entry per id, always the same length as `assigned_operator_ids`.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string",
                                                                "description": "Same HR id as the matching `assigned_operator_ids` entry."
                                                            },
                                                            "user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The same operator's `user_id`, the SAME id space as ```GET /me```'s own `users.user_id`. ``null`` if the id no longer resolves to a real person."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "``null`` if the id no longer resolves to a real person (e.g. a deleted account) \u2014 never omitted, so this array always lines up 1:1 with `assigned_operator_ids`."
                                                            }
                                                        }
                                                    }
                                                },
                                                "assigned_to_me": {
                                                    "type": "boolean",
                                                    "description": "Whether the CALLER themselves is among `assigned_operator_ids` \u2014 resolved server-side so callers never need to bridge this against ```GET /me```'s `personal_code` by hand."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Update a ticket (status, priority, subject, app, queue, author)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id, from the `id` field of an item in ```GET /tickets```' `tickets` array (or from the response of ```POST /tickets```, right after creating it).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "status": {
                                        "type": "integer",
                                        "enum": [
                                            -1,
                                            0,
                                            1,
                                            2
                                        ],
                                        "x-enum-descriptions": {
                                            "-1": "Refused",
                                            "0": "Draft",
                                            "1": "Open",
                                            "2": "Solved"
                                        },
                                        "description": "Requires operator access. Any value outside ``-1``/``0``/``1``/``2`` is rejected with a ``422``, never silently coerced. ``3`` (Paused) is deliberately NOT settable here \u2014 use the dedicated ```POST /tickets/{id}/pause``` endpoint instead, which also records `paused_reason`/`paused_at`; setting status directly would produce a \"paused\" ticket with none of that bookkeeping. For resume/reopen, similarly prefer ```POST /tickets/{id}/resume```/```POST /tickets/{id}/reopen``` over a raw status write \u2014 those apply extra rules this field bypasses (e.g. reopen's time-window check for a non-operator author)."
                                    },
                                    "priority": {
                                        "type": "integer",
                                        "enum": [
                                            1,
                                            2,
                                            3,
                                            4
                                        ],
                                        "x-enum-descriptions": {
                                            "1": "Low",
                                            "2": "Medium",
                                            "3": "High",
                                            "4": "Critical"
                                        },
                                        "description": "Requires operator access. Any value outside ``1``-``4`` is rejected with a ``422``, never silently coerced (e.g. a non-numeric string casts to ``0``, which then fails this same check)."
                                    },
                                    "subject": {
                                        "type": "string",
                                        "description": "Requires operator access. Cannot be set to an empty string."
                                    },
                                    "app": {
                                        "type": "string",
                                        "description": "Requires operator access. Free text, not validated against a fixed list; send an empty string to clear it."
                                    },
                                    "queue_id": {
                                        "type": "integer",
                                        "description": "Requires operator access on the ticket's CURRENT queue \u2014 except for an orphan ticket (`queue_id` was already ``0``/``null``), which requires founder access instead, mirroring the dashboard's separate founder-only \"assign orphan\" action (an orphan ticket has no queue for anyone to be an \"operator\" of yet). Must refer to an active, on-account queue \u2014 validated with a ``422``, not silently ignored. Moving queues resets `assigned_operator_ids` to empty and forces `status` back to Open (``1``), same side effect as the dashboard's own change-queue action."
                                    },
                                    "author_user_id": {
                                        "type": "integer",
                                        "description": "Requires operator access. Must be the id of a user belonging to your own account \u2014 validated with a ``422`` if not, never silently accepted. Reflected back as `author_id` in the response."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "See ```GET /tickets```' `id` field."
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "description": "The ticket's subject after this update (unchanged fields keep their prior value)."
                                                },
                                                "status": {
                                                    "type": "integer",
                                                    "enum": [
                                                        -1,
                                                        0,
                                                        1,
                                                        2,
                                                        3
                                                    ],
                                                    "description": "The ticket's status after this update."
                                                },
                                                "status_label": {
                                                    "type": "string",
                                                    "enum": [
                                                        "refused",
                                                        "draft",
                                                        "open",
                                                        "solved",
                                                        "paused"
                                                    ],
                                                    "description": "Lowercase name of `status`, above."
                                                },
                                                "priority": {
                                                    "type": "integer",
                                                    "enum": [
                                                        1,
                                                        2,
                                                        3,
                                                        4
                                                    ],
                                                    "description": "The ticket's priority after this update."
                                                },
                                                "queue_id": {
                                                    "type": "integer",
                                                    "nullable": true,
                                                    "description": "The ticket's queue after this update."
                                                },
                                                "queue_name": {
                                                    "type": "string",
                                                    "description": "Nullable, mirrors `queue_id`."
                                                },
                                                "app": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "The catalog app this ticket is linked to, if any \u2014 clear it by sending an empty string."
                                                },
                                                "author_id": {
                                                    "type": "string",
                                                    "description": "Reflects `author_user_id` if that field was part of this ```PATCH```, otherwise unchanged."
                                                },
                                                "assigned_operator_ids": {
                                                    "type": "array",
                                                    "description": "Reset to an empty array if this ```PATCH``` changed `queue_id`, otherwise unchanged.",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "description": "Unchanged by this (or any) endpoint \u2014 a ```PATCH``` never touches `created_at`."
                                                },
                                                "modified_at": {
                                                    "type": "string",
                                                    "description": "Set by the server to the current time as part of this update. Not settable by the caller \u2014 there is no field named `modified_at` (or similar) accepted anywhere in this request body; any such value in the JSON you send would simply be ignored, not applied."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/pause": {
            "post": {
                "summary": "Pause an open ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reason": {
                                        "type": "string",
                                        "enum": [
                                            "testing",
                                            "multi_app_change",
                                            "other"
                                        ],
                                        "description": "Any other value is silently treated as ``other``, never rejected \u2014 matches the dashboard's own fallback for an unrecognized reason. Defaults to ``other`` if omitted."
                                    },
                                    "reason_custom": {
                                        "type": "string",
                                        "description": "Free text, used only when `reason` = ``other`` (ignored otherwise, even if sent). Truncated to 255 characters."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Same shape as ```PATCH```'s response \u2014 `status` will be ``3`` (paused)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/resume": {
            "post": {
                "summary": "Resume a paused ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Same shape as ```PATCH```'s response \u2014 `status` will be ``1`` (open). ``422`` if the ticket wasn't Paused (`status` ``3``) to begin with."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/reopen": {
            "post": {
                "summary": "Reopen a solved ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Same shape as ```PATCH```'s response \u2014 `status` will be ``1`` (open). ``422`` if the ticket wasn't Solved (`status` ``2``). ``403`` if you're not an operator on this ticket AND (you're not the author, OR you are but the queue's reopen time-window since the ticket was last modified has already passed)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/assignable-operators": {
            "get": {
                "summary": "List who can be assigned to a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "operators": {
                                                    "type": "array",
                                                    "description": "Empty if the ticket is orphaned (no queue) or its queue has no structures/members configured.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer",
                                                                "description": "The operator's own user id."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "description": "The operator's display name."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/assignments": {
            "post": {
                "summary": "Assign an operator to a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "operator_user_id": {
                                        "type": "integer",
                                        "description": "Omit entirely, or send the literal string ``me``, to assign yourself \u2014 otherwise the id of a user belonging to your own account (validated with a ``422`` if not; a nonexistent or cross-account id is never silently accepted). Requires YOU to have operator access on this ticket, regardless of who's actually being assigned \u2014 assigning a colleague still requires you, the caller, to be an operator here."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The updated ticket (same shape as ```PATCH```'s response) \u2014 check `assigned_operator_ids` for the new assignment. Already being assigned is a harmless no-op (``200``, unchanged), not an error."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/assignments/{operator_id}": {
            "delete": {
                "summary": "Unassign an operator from a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "operator_id",
                        "in": "path",
                        "required": true,
                        "description": "The operator to unassign \u2014 either the literal string ``me``, or an id from that ticket's `assigned_operator_ids` array (see ```GET /tickets/{id}```).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The updated ticket (same shape as ```PATCH```'s response). `{operator_id}` in the URL is the operator's id, or the literal ``me`` \u2014 NOT the same `{id}` as the ticket earlier in the path; the two are unrelated values. Unassigning someone not currently assigned is a harmless no-op (``200``, unchanged), not an error."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/watchers": {
            "post": {
                "summary": "Watch a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "watching": {
                                                    "type": "boolean",
                                                    "description": "Always ``true`` on success \u2014 your own watch state after this call. No operator access required; any user with at least read access to this ticket can watch it (same as the dashboard, where the watch toggle isn't restricted to operators)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Unwatch a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "watching": {
                                                    "type": "boolean",
                                                    "description": "Always ``false`` on success."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/shares": {
            "post": {
                "summary": "Share a ticket with a user or queue",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "target_type": {
                                        "type": "string",
                                        "enum": [
                                            "user",
                                            "queue"
                                        ],
                                        "description": "Any other value is rejected with a ``422``."
                                    },
                                    "target_id": {
                                        "type": "integer",
                                        "description": "The target user's or target queue's id, matching `target_type` \u2014 validated to actually exist on your account with a ``422`` if not."
                                    },
                                    "permission": {
                                        "type": "string",
                                        "enum": [
                                            "read",
                                            "edit"
                                        ],
                                        "description": "Defaults to ``read`` if omitted. Any other value is rejected with a ``422``."
                                    },
                                    "role": {
                                        "type": "string",
                                        "enum": [
                                            "user",
                                            "operator"
                                        ],
                                        "description": "Defaults to ``user`` if omitted. Any other value is rejected with a ``422``. Only `role` = ``operator`` grants moderator-level access on this ticket via the share (`permission` = ``edit`` alone, with `role` = ``user``, does NOT)."
                                    }
                                },
                                "required": [
                                    "target_type",
                                    "target_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The share's own identifier \u2014 use this in ```DELETE /tickets/{id}/shares/{share_id}```."
                                                },
                                                "target_type": {
                                                    "type": "string",
                                                    "enum": [
                                                        "user",
                                                        "queue"
                                                    ],
                                                    "description": "Echoes what you sent."
                                                },
                                                "target_id": {
                                                    "type": "integer",
                                                    "description": "Echoes what you sent."
                                                },
                                                "permission": {
                                                    "type": "string",
                                                    "enum": [
                                                        "read",
                                                        "edit"
                                                    ],
                                                    "description": "Echoes what you sent (or the ``read`` default)."
                                                },
                                                "role": {
                                                    "type": "string",
                                                    "enum": [
                                                        "user",
                                                        "operator"
                                                    ],
                                                    "description": "Echoes what you sent (or the ``user`` default)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/shares/{share_id}": {
            "delete": {
                "summary": "Remove a ticket share",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "share_id",
                        "in": "path",
                        "required": true,
                        "description": "One share's own id, from the `id` field of an item in that ticket's `shares` array (see ```GET /tickets/{id}```), or from the response of ```POST /tickets/{id}/shares``` right after creating it.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean",
                                                    "description": "Always ``true`` \u2014 removing a share id that doesn't exist (already removed, or never existed) is a harmless no-op, not an error."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/links": {
            "post": {
                "summary": "Link two tickets (generic, non-parent/child)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "target_ticket_id": {
                                        "type": "integer",
                                        "description": "The other ticket's id \u2014 must exist on your account and differ from this ticket's own `{id}`, both enforced with a ``422``/``404``."
                                    }
                                },
                                "required": [
                                    "target_ticket_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ticket_id": {
                                                    "type": "integer",
                                                    "description": "This ticket's id (echoes the `{id}` from the URL)."
                                                },
                                                "linked_ticket_id": {
                                                    "type": "integer",
                                                    "description": "Echoes `target_ticket_id`."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/links/{target_id}": {
            "delete": {
                "summary": "Remove a ticket link",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "target_id",
                        "in": "path",
                        "required": true,
                        "description": "The OTHER ticket's id, from that ticket's `linked_ticket_ids` array (see ```GET /tickets/{id}```).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean",
                                                    "description": "Always ``true`` if `{target_id}` resolved to a real ticket on your account (``404`` if it doesn't) \u2014 removing a link that doesn't currently exist between the two is still a harmless no-op, not an error."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/children": {
            "post": {
                "summary": "Create a new child ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The PARENT ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subject": {
                                        "type": "string",
                                        "description": "The new child ticket's title."
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "The new child ticket's first comment. Plain text or HTML both accepted, stored/returned as-is \u2014 see `content` on the `comments` array under ```GET /tickets/{id}```."
                                    },
                                    "queue_id": {
                                        "type": "integer",
                                        "description": "Must be an active, on-account queue \u2014 validated with a ``422`` if not. Unlike ```POST /tickets``` (the top-level create endpoint), there is no eligibility check here at all: creating a child ticket already requires you to be an operator on the PARENT, so the same \"not everyone can file anywhere\" concern doesn't apply."
                                    },
                                    "parent_visible": {
                                        "type": "boolean",
                                        "description": "Whether the PARENT ticket's non-operator author is allowed to know this child exists (shows up in their view of the parent's `children` array). Defaults to ``false`` \u2014 hidden from them \u2014 if omitted."
                                    }
                                },
                                "required": [
                                    "subject",
                                    "content",
                                    "queue_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new child ticket's id (same response shape as ```GET /tickets/{id}```, minus `comments`/`parent`/`children`/`linked_ticket_ids`/`shares`/`watching`, plus the `parent_visible` field below)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/children/link": {
            "post": {
                "summary": "Link an EXISTING ticket as a child",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The PARENT ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "child_ticket_id": {
                                        "type": "integer",
                                        "description": "The other ticket's id \u2014 must exist on your account and differ from this ticket's own `{id}`, both enforced with a ``422``/``404``. That other ticket does NOT need to already be one you operate \u2014 only this (the parent) ticket does."
                                    },
                                    "parent_visible": {
                                        "type": "boolean",
                                        "description": "Same meaning as on the create-a-new-child endpoint. Defaults to ``false`` if omitted."
                                    }
                                },
                                "required": [
                                    "child_ticket_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "parent_ticket_id": {
                                                    "type": "integer",
                                                    "description": "This ticket's id."
                                                },
                                                "child_ticket_id": {
                                                    "type": "integer",
                                                    "description": "Echoes `child_ticket_id`."
                                                },
                                                "parent_visible": {
                                                    "type": "boolean",
                                                    "description": "Echoes what you sent (or the ``false`` default)."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/children/{child_id}": {
            "patch": {
                "summary": "Toggle a child ticket's visibility to the parent's author",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The PARENT ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "child_id",
                        "in": "path",
                        "required": true,
                        "description": "The child ticket's id, from that ticket's `children` array (see ```GET /tickets/{id}```).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "parent_visible": {
                                        "type": "boolean",
                                        "description": "The only field this endpoint accepts \u2014 there is no way to change which ticket is the parent/child here, only whether the relationship is visible to the parent's non-operator author."
                                    }
                                },
                                "required": [
                                    "parent_visible"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "parent_ticket_id": {
                                                    "type": "integer",
                                                    "description": "This ticket's id."
                                                },
                                                "child_ticket_id": {
                                                    "type": "integer",
                                                    "description": "The `{child_id}` from the URL."
                                                },
                                                "parent_visible": {
                                                    "type": "boolean",
                                                    "description": "The new value, after this update."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Unlink a child ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The PARENT ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "child_id",
                        "in": "path",
                        "required": true,
                        "description": "The child ticket's id, from that ticket's `children` array (see ```GET /tickets/{id}```).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean",
                                                    "description": "Always ``true`` if `{child_id}` resolved to a real ticket on your account (``404`` if it doesn't). Only removes the parent/child RELATIONSHIP \u2014 the child ticket itself is completely untouched and still exists as its own ticket."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/combine": {
            "post": {
                "summary": "Merge this ticket into another (this ticket becomes Solved)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket being merged AWAY \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "target_ticket_id": {
                                        "type": "integer",
                                        "description": "The SURVIVING ticket's id \u2014 must exist on your account and differ from this ticket's own `{id}`. This ticket's comments and time logs all move onto it; this ticket itself is not deleted, just marked Solved and linked to the target as its parent."
                                    },
                                    "author_choice": {
                                        "type": "string",
                                        "enum": [
                                            "current",
                                            "target"
                                        ],
                                        "description": "``current`` reassigns the TARGET ticket's author to match THIS ticket's author (i.e. this ticket's author \"wins\"). Defaults to ``target`` if omitted \u2014 leave the target ticket's existing author as-is."
                                    }
                                },
                                "required": [
                                    "target_ticket_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ticket_id": {
                                                    "type": "integer",
                                                    "description": "This (now-Solved) ticket's id."
                                                },
                                                "merged_into_ticket_id": {
                                                    "type": "integer",
                                                    "description": "Echoes `target_ticket_id` \u2014 the surviving ticket."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/divide": {
            "post": {
                "summary": "Split part of this ticket into a new one",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket being split FROM \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subject": {
                                        "type": "string",
                                        "description": "The new, split-off ticket's subject."
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "The new ticket's first comment."
                                    },
                                    "comment_ids": {
                                        "type": "array",
                                        "description": "Existing comment ids from THIS ticket (the `id` field of an item in ```GET /tickets/{id}```'s `comments` array) to MOVE onto the new ticket. An id that doesn't belong to this ticket is silently ignored, not an error. Omit for an empty array \u2014 none moved.",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "required": [
                                    "subject",
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new ticket's id (same response shape as ```GET /tickets/{id}```, minus `comments`/`parent`/`children`/`linked_ticket_ids`/`shares`/`watching`). Starts at `status` ``1`` (Open), inherits this ticket's queue, app, and author."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/time-logs": {
            "post": {
                "summary": "Log time spent on a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "minutes": {
                                        "type": "integer",
                                        "description": "Must be a positive integer greater than ``0`` \u2014 rejected with a ``422`` otherwise (including ``0``, negative values, or anything that doesn't cast to a positive int)."
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Free-text note on what the time was spent on. Optional \u2014 omit for an empty string."
                                    }
                                },
                                "required": [
                                    "minutes"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ticket_id": {
                                                    "type": "integer",
                                                    "description": "This ticket's id."
                                                },
                                                "minutes": {
                                                    "type": "integer",
                                                    "description": "Echoes what you sent."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/comments/{comment_id}": {
            "patch": {
                "summary": "Edit a comment",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "comment_id",
                        "in": "path",
                        "required": true,
                        "description": "The comment's own id, from the `id` field of an item in that ticket's `comments` array (see ```GET /tickets/{id}```).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "content": {
                                        "type": "string",
                                        "description": "The comment's new content, replacing what was there before entirely (not appended). Cannot be empty."
                                    }
                                },
                                "required": [
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The comment's own id (echoes `{comment_id}` from the URL)."
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "description": "The comment's new content, as saved."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/history": {
            "get": {
                "summary": "Get a ticket's audit log",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ticket_id": {
                                                    "type": "integer",
                                                    "description": "This ticket's id."
                                                },
                                                "history": {
                                                    "type": "array",
                                                    "description": "Every recorded action on this ticket, newest first. Operator-only \u2014 ``403`` for anyone else, matching the dashboard's own History panel (which sits inside the same moderator-only sidebar as everything else operator-facing, not shown to the author or a shared user at all).",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "action_type": {
                                                                "type": "string",
                                                                "description": "e.g. `STATUS_CHANGE`, `PRIORITY_CHANGE`, `QUEUE_CHANGE`, `ASSIGNED_ME`, `ASSIGNED_OPERATOR`, `UNASSIGNED`, `REOPENED`, `PAUSED`, `RESUMED`, `NEW_COMMENT`, `COMMENT_EDITED`, `TIME_LOGGED`, `SHARED`, `UNSHARED`, `TICKET_LINKED`, `TICKET_UNLINKED`, `TICKET_COMBINED`, `TICKET_DIVIDED`, `CHILD_CREATED`, `CHILD_LINKED`, `CHILD_UNLINKED`, `CHILD_VISIBILITY`, `APP_CHANGE`, `TITLE_CHANGE`, `AUTHOR_CHANGE`, `WATCHER_ADDED`, `WATCHER_REMOVED`, or a bulk variant ending `_BULK`. Not a fixed enum here \u2014 every action this API (or the dashboard) performs writes its own type, and new ones can appear as this API grows."
                                                            },
                                                            "actor_id": {
                                                                "type": "string",
                                                                "description": "The HR id of whoever performed the action."
                                                            },
                                                            "actor_user_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "The same actor's `user_id`, the SAME id space as ```GET /me```'s own `users.user_id`. ``null`` if resolution failed."
                                                            },
                                                            "actor_name": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The actor's resolved display name, if they still exist on this account. ``null`` if resolution failed (e.g. a since-removed account)."
                                                            },
                                                            "old_value": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The RAW stored value \u2014 meaning depends on `action_type` (e.g. a numeric status code for `STATUS_CHANGE`, an HR id for `ASSIGNED_ME`/`ASSIGNED_OPERATOR`/`AUTHOR_CHANGE`, already a real name for `QUEUE_CHANGE`). Often ``null`` for actions with no meaningful \"before\" state (e.g. `NEW_COMMENT`, `WATCHER_ADDED`). See `old_value_label` for a human-readable version where one exists."
                                                            },
                                                            "new_value": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The RAW stored value, mirrors `old_value` \u2014 e.g. the new status code, or (for `NEW_COMMENT` specifically) the first 100 characters of the comment that was posted, INCLUDING for an internal note. Since this whole endpoint is already operator-only, that's not a cross-role leak here \u2014 but worth knowing if you ever build something that surfaces this data further downstream to a non-operator audience. See `new_value_label` for a human-readable version where one exists."
                                                            },
                                                            "old_value_label": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Human-readable version of `old_value` \u2014 a resolved status name for `STATUS_CHANGE`, a resolved person name for `ASSIGNED_ME`/`ASSIGNED_OPERATOR`/`AUTHOR_CHANGE`. ``null`` for every other `action_type` (nothing to resolve) or if resolution failed \u2014 prefer this over `old_value` when present."
                                                            },
                                                            "new_value_label": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "Human-readable version of `new_value`, same rules as `old_value_label`."
                                                            },
                                                            "timestamp": {
                                                                "type": "string",
                                                                "description": "``YYYY-MM-DD HH:MM:SS``, when the action was recorded."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/attachments": {
            "get": {
                "summary": "List a ticket's attachments",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "attachments": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "comment_id": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "``null`` when attached to the ticket's opening message rather than a specific reply."
                                                            },
                                                            "kind": {
                                                                "type": "string",
                                                                "description": "One of: ``file``, ``screenshot``, ``diagnostic``."
                                                            },
                                                            "filename": {
                                                                "type": "string"
                                                            },
                                                            "mime_type": {
                                                                "type": "string"
                                                            },
                                                            "uploaded_by": {
                                                                "type": "integer",
                                                                "nullable": true,
                                                                "description": "HR id (personal_code) of the uploader."
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Add a new attachment to a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file_base64": {
                                        "type": "string",
                                        "description": "Raw base64, or a ``data:mime;base64,...`` URI \u2014 either form is accepted. 10 MB cap. Content is sniffed server-side; accepted types are pdf/jpg/png/doc/docx/gz regardless of what the filename or a claimed MIME type says."
                                    },
                                    "kind": {
                                        "type": "string",
                                        "description": "One of: ``file`` (default), ``screenshot``, ``diagnostic`` \u2014 a display hint only, not enforced against the actual file content."
                                    },
                                    "comment_id": {
                                        "type": "integer",
                                        "description": "Attach to one specific reply instead of the ticket's opening message."
                                    }
                                },
                                "required": [
                                    "file_base64"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "attachment": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/attachments/{attachment_id}": {
            "get": {
                "summary": "Download one attachment's raw bytes",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "string",
                                                "format": "binary"
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mobile/crash-reports": {
            "post": {
                "summary": "Log a mobile-app crash (write-only)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "message": {
                                        "type": "string",
                                        "description": "Error message. Truncated server-side at 500 characters."
                                    },
                                    "stack": {
                                        "type": "string",
                                        "description": "Stack trace, if available. Truncated server-side at 8000 characters."
                                    },
                                    "screen": {
                                        "type": "string",
                                        "description": "React Navigation route name active at crash time."
                                    },
                                    "is_fatal": {
                                        "type": "boolean",
                                        "description": "Whether this crash actually terminated the app, as opposed to a caught/recovered error."
                                    },
                                    "app_version": {
                                        "type": "string",
                                        "description": "The running build's own fingerprint (buildCode)."
                                    },
                                    "ota_id": {
                                        "type": "string",
                                        "description": "The running OTA update's id, if any."
                                    },
                                    "is_embedded_launch": {
                                        "type": "boolean",
                                        "description": "Whether the JS bundle running at crash time was the natively-embedded one, or one fetched over the air."
                                    }
                                },
                                "required": [
                                    "message"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object",
                                                "properties": {
                                                    "logged": {
                                                        "type": "boolean"
                                                    },
                                                    "id": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/app-support": {
            "get": {
                "summary": "List MY App Support tickets (mobile bug reports)",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "1-200. Defaults to 50.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "tickets": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "pagination": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer",
                                                    "description": "Current page number."
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Rows per page."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total matching rows across all pages."
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "description": "Total number of pages."
                                                },
                                                "next_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the next page, same filters applied. Null on the last page."
                                                },
                                                "prev_page_url": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Full URL to fetch the previous page, same filters applied. Null on the first page."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Submit a new App Support (bug report) ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subject": {
                                        "type": "string",
                                        "description": "A short headline for the report."
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "The opening message \u2014 typically the user's own description of the bug, from the shake-to-report form."
                                    }
                                },
                                "required": [
                                    "subject",
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object"
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/app-support/{id}": {
            "get": {
                "summary": "Get one App Support ticket, its replies, and its attachments",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object",
                                                "properties": {
                                                    "comments": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object"
                                                        }
                                                    },
                                                    "attachments": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/app-support/{id}/replies": {
            "post": {
                "summary": "Reply to one of my App Support tickets",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "content": {
                                        "type": "string",
                                        "description": "The reply text."
                                    }
                                },
                                "required": [
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "object"
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/app-support/{id}/attachments": {
            "get": {
                "summary": "List an App Support ticket's attachments",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "attachments": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Attach a screenshot, diagnostic bundle, or file to one of my App Support tickets",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file_base64": {
                                        "type": "string",
                                        "description": "The attachment's raw bytes, base64-encoded."
                                    },
                                    "kind": {
                                        "type": "string",
                                        "description": "One of: ``file``, ``screenshot``, ``diagnostic``."
                                    },
                                    "comment_id": {
                                        "type": "integer",
                                        "description": "Which comment this attachment belongs to \u2014 pass the exact id returned by ```POST /app-support``` (as `comment_id`) or ```POST /app-support/{id}/replies``` (as `id`). Falls back to the ticket's own latest comment if omitted."
                                    }
                                },
                                "required": [
                                    "file_base64"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "attachment": {
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/app-support/{id}/attachments/{attachment_id}": {
            "get": {
                "summary": "Download one App Support attachment's raw bytes",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "type": "string",
                                                "format": "binary"
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/bulk": {
            "post": {
                "summary": "Apply one change to multiple tickets at once",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "ticket_ids": {
                                        "type": "array",
                                        "description": "Ids to update. Every id is independently re-verified server-side to actually be in one of YOUR operator queues before anything is touched \u2014 an id outside that set is silently placed in the response's `skipped_ticket_ids` instead of erroring the whole batch or being applied anyway.",
                                        "items": {
                                            "type": "integer"
                                        }
                                    },
                                    "action": {
                                        "type": "string",
                                        "enum": [
                                            "status",
                                            "priority",
                                            "app",
                                            "queue_id"
                                        ],
                                        "description": "Which single field to change on every ticket in `ticket_ids`. Any other value is rejected with a ``422``."
                                    },
                                    "value": {
                                        "type": "string",
                                        "description": "The new value, validated according to `action` just like the equivalent single-ticket ```PATCH``` field: `action` = `status` needs one of ``-1``/``0``/``1``/``2`` (``3``/Paused is deliberately excluded here too \u2014 use ```POST /tickets/{id}/pause``` per-ticket instead, since pausing records its own `paused_reason`/`paused_at` this bulk action has no way to set), `action` = `priority` needs one of ``1``/``2``/``3``/``4`` (both rejected with a ``422`` if outside those, including a non-numeric string \u2014 nothing is silently coerced to a \"closest\" valid value), `action` = `queue_id` needs an active on-account queue id (``422`` if not; also resets each ticket's `assigned_operator_ids` and forces `status` to Open, same as ```PATCH /tickets/{id}```'s `queue_id` side effect), `action` = `app` accepts any free-text string."
                                    }
                                },
                                "required": [
                                    "ticket_ids",
                                    "action",
                                    "value"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "updated_ticket_ids": {
                                                    "type": "array",
                                                    "description": "Ids that were actually changed.",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "skipped_ticket_ids": {
                                                    "type": "array",
                                                    "description": "Requested ids that weren't in any queue you operate, so nothing was changed for them \u2014 not an error, just excluded. Compare against your original `ticket_ids` to see what didn't apply.",
                                                    "items": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/replies": {
            "post": {
                "summary": "Reply to a ticket",
                "security": [
                    {
                        "UserKey": []
                    }
                ],
                "x-status": "enabled",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The ticket's id \u2014 same as on ```GET /tickets/{id}```.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "content": {
                                        "type": "string",
                                        "description": "The reply text. Cannot be empty or whitespace-only."
                                    },
                                    "is_internal": {
                                        "type": "boolean",
                                        "description": "Only honored when you're an operator on this ticket \u2014 silently treated as ``false`` otherwise (never rejected), same as a non-operator never seeing the internal-note option in the dashboard at all. Defaults to ``false`` if omitted."
                                    }
                                },
                                "required": [
                                    "content"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "The new comment's own id (same id space as ```GET /tickets/{id}```'s `comments[].id`)."
                                                },
                                                "ticket_id": {
                                                    "type": "integer",
                                                    "description": "The ticket's id (echoes the `{id}` from the URL)."
                                                },
                                                "author_id": {
                                                    "type": "string",
                                                    "description": "Your own id \u2014 you are always the commenter on a reply you post."
                                                },
                                                "author_user_id": {
                                                    "type": "integer",
                                                    "nullable": true,
                                                    "description": "Your own `user_id`, the SAME id space as ```GET /me```'s own `users.user_id`."
                                                },
                                                "author_name": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "Your own resolved display name."
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "description": "Echoes what you sent."
                                                },
                                                "is_internal": {
                                                    "type": "boolean",
                                                    "description": "The actual value stored \u2014 ``false`` if you sent ``true`` but weren't an operator (see the request field's own description)."
                                                },
                                                "is_staff": {
                                                    "type": "boolean",
                                                    "description": "``true`` if you were acting as an operator on this ticket when you posted this reply."
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "description": "Set by the server to the current time at post time. Not settable by the caller."
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "data": {
                                            "type": "object",
                                            "nullable": true
                                        },
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "TenantKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-Api-Tenant-Key"
            },
            "UserKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-Api-User-Key"
            }
        }
    },
    "x-missing-metadata": [
        "docs/applications",
        "docs/reference",
        "docs/auth",
        "docs/tenant",
        "docs/organization",
        "docs/users",
        "docs/ticketing",
        "docs/queues",
        "docs/tickets",
        "docs/utilities",
        "docs/openstudio-internal",
        "contact-points",
        "openstudio-support",
        "mailboxes",
        "protocol-documents",
        "digisign",
        "intranet"
    ]
}