{
    "openapi": "3.1.0",
    "info": {
        "title": "Flowyer Agent API",
        "version": "90bdda12e80e",
        "description": "Lets an external AI agent read, create and modify records in Flowyer on behalf of ONE user, with that user's own permissions, narrowed further by the scopes of the API key. With the matching scopes it can also upload and download matter documents; downloading a document's contents needs its own `documents:download` scope (`documents:read` only lists them).\n\nModifying a record is a PATCH on its own path; send `expected_updated_at` from your last read, and a change made by someone else in the meantime answers 409. What a key can NEVER do: delete anything (DELETE always answers 405) or see data the user cannot see in Flowyer (module permissions and case visibility rules apply unchanged).\n\nScopes: each operation names the scope it needs (`x-scope`). A missing scope answers 403 with `error: \"scope_missing\"`. The scopes of an existing credential cannot be changed: for a static API key the owner creates a new key with the scope in Flowyer under Settings > API keys and replaces the old one; an OAuth-connected app has to be reconnected so that the user can approve the missing scope.\n\nErrors always have the same shape: `error` (machine code), `message` (English), `message_localized` (the office language) and optional `details`. Repeat `message` or `message_localized` to the user. Do not retry an unchanged request on 401/403/404/422, except 404 `upload_not_finished` (finish the PUT to `upload_url`, then call complete again) and 401 `expired_key` for an OAuth access token (refresh the token first).\n\nCreates are idempotent: send an `Idempotency-Key` header (or an `idempotency_key` field) with a unique value per logical operation and retry safely. The same key returns the same record; different keys always create different records. Without a key, an identical create repeated within 120 seconds returns the first record. A retry whose first call created a record that has since been deleted or is not visible to the user answers 404 `replay_not_visible`: nothing new was created, do not create it again.\n\nLists are paginated with `limit`/`offset`; `pagination.total` is the full count. Dates are `YYYY-MM-DD`; timestamps are ISO 8601 with the office's UTC offset (see `GET /me` -> office.timezone).\n\nAlways call the exact `https://www.` host of the office (a redirect would drop the Authorization header). Rate limit: see `GET /me`."
    },
    "servers": [
        {
            "url": "https://www.flowyer.it/api/agent",
            "description": "Default host"
        },
        {
            "url": "https://www.flowyer.hu/api/agent"
        },
        {
            "url": "https://www.flowyer.com/api/agent"
        },
        {
            "url": "https://www.flowyer.ro/api/agent"
        },
        {
            "url": "https://www.flowyer.de/api/agent"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "Me"
        },
        {
            "name": "Colleagues"
        },
        {
            "name": "Matters"
        },
        {
            "name": "Clients"
        },
        {
            "name": "Tasks"
        },
        {
            "name": "Workhours"
        },
        {
            "name": "Costs"
        },
        {
            "name": "Invoices"
        },
        {
            "name": "Documents"
        },
        {
            "name": "Knowledge base"
        },
        {
            "name": "Emails"
        },
        {
            "name": "Litigation"
        },
        {
            "name": "Mail register"
        },
        {
            "name": "Comments"
        },
        {
            "name": "Trials"
        },
        {
            "name": "Courts"
        },
        {
            "name": "Hr"
        },
        {
            "name": "Calendar"
        },
        {
            "name": "Bookings"
        },
        {
            "name": "Tickets"
        },
        {
            "name": "Portal"
        }
    ],
    "paths": {
        "/bookings": {
            "get": {
                "operationId": "bookings.list",
                "tags": [
                    "Bookings"
                ],
                "summary": "List bookings",
                "description": "Lists the office's appointment bookings (időpontfoglalások), newest first. Optionally filtered by a from/to day range (booking time zone), a lawyer (user_id), a status or updated_since. Every key-holder sees all lawyers' bookings.",
                "x-scope": "bookings:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-01-01"
                            ]
                        },
                        "description": "Only bookings on or after this day (YYYY-MM-DD), matched literally against the booking-zone date.",
                        "example": "2026-01-01"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-12-31"
                            ]
                        },
                        "description": "Only bookings on or before this day (YYYY-MM-DD).",
                        "example": "2026-12-31"
                    },
                    {
                        "name": "user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Filter to one lawyer (user_id from colleagues.list). Omit for every lawyer of the office."
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "confirmed",
                                "cancelled",
                                "completed",
                                "awaiting_payment",
                                "expired"
                            ]
                        },
                        "description": "Filter by status."
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        },
                        "description": "Only bookings changed at or after this ISO 8601 time (updated_at is office-zone naive)."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            4321
                                                        ]
                                                    },
                                                    "booking_number": {
                                                        "type": "string",
                                                        "description": "Human booking number, e.g. \"#B-0001\"."
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "pending",
                                                            "confirmed",
                                                            "cancelled",
                                                            "completed",
                                                            "awaiting_payment",
                                                            "expired"
                                                        ],
                                                        "description": "pending = awaiting the lawyer's confirmation; confirmed = approved; cancelled/completed; awaiting_payment/expired belong to the pay-before-confirm flow."
                                                    },
                                                    "source": {
                                                        "type": "string",
                                                        "enum": [
                                                            "flowyer",
                                                            "website",
                                                            "embed_widget",
                                                            "manual"
                                                        ],
                                                        "description": "Where the booking came from. An API-created booking is \"manual\"."
                                                    },
                                                    "lawyer": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The lawyer (user_id from colleagues.list) the appointment is with."
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date",
                                                        "description": "Calendar date in the booking time zone (YYYY-MM-DD), stored literally."
                                                    },
                                                    "start_time": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Start time HH:MM in the booking time zone."
                                                    },
                                                    "end_time": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "End time HH:MM in the booking time zone."
                                                    },
                                                    "start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Unambiguous ISO 8601 instant of the start, composed with the booking time zone. Use this to compare instants across zones."
                                                    },
                                                    "end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Unambiguous ISO 8601 instant of the end."
                                                    },
                                                    "timezone": {
                                                        "type": "string",
                                                        "description": "The booking time zone (booking_settings.timezone), e.g. \"Europe/Budapest\". It governs date, start_time and end_time."
                                                    },
                                                    "location_preference": {
                                                        "type": "string",
                                                        "enum": [
                                                            "office",
                                                            "online"
                                                        ],
                                                        "description": "Whether the consultation is in the office or online."
                                                    },
                                                    "meeting_link": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Online-meeting URL, when set."
                                                    },
                                                    "client": {
                                                        "type": "object",
                                                        "properties": {
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "email": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "phone": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "description": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The external client who booked: name, e-mail, phone and the subject/notes. Personal data — for office staff only."
                                                    },
                                                    "gdpr_consent": {
                                                        "type": "boolean",
                                                        "description": "Whether the client's data-handling consent is recorded."
                                                    },
                                                    "gdpr_consent_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "When the consent was recorded."
                                                    },
                                                    "cancel_reason": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Reason recorded on cancellation."
                                                    },
                                                    "payment": {
                                                        "type": "object",
                                                        "properties": {
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "none",
                                                                    "awaiting",
                                                                    "partial",
                                                                    "paid",
                                                                    "refunded"
                                                                ]
                                                            },
                                                            "method": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "enum": [
                                                                    "card",
                                                                    "transfer",
                                                                    null
                                                                ]
                                                            },
                                                            "amount": {
                                                                "type": [
                                                                    "number",
                                                                    "null"
                                                                ]
                                                            },
                                                            "currency": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "invoice_number": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Read-only payment state. The API never changes payment; booking fees are handled in Flowyer."
                                                    },
                                                    "confirmed_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "cancelled_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Pass this to bookings.update / bookings.confirm / bookings.cancel as expected_updated_at."
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Present when an external agent created the booking through this API."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "bookings.create",
                "tags": [
                    "Bookings"
                ],
                "summary": "Create booking",
                "description": "Books an appointment and EMAILS THE CLIENT the confirmation. Requires a free slot for the lawyer (else 409); the office calendar never blocks. source is \"manual\". An Idempotency-Key replay neither re-books nor re-emails.",
                "x-scope": "bookings:create",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "user_id": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Lawyer the appointment is with (user_id from colleagues.list; must be an active office colleague).",
                                        "examples": [
                                            42
                                        ]
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Appointment day (YYYY-MM-DD) in the booking time zone.",
                                        "examples": [
                                            "2026-03-02"
                                        ]
                                    },
                                    "time": {
                                        "type": "string",
                                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                        "description": "Start time HH:MM (24h) in the booking time zone. The end time is time + the office slot length. Must be a free slot.",
                                        "examples": [
                                            "09:00"
                                        ]
                                    },
                                    "client_name": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "The client's name. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Kovács Anna"
                                        ]
                                    },
                                    "client_email": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "description": "The client's e-mail: the recipient of the confirmation.",
                                        "examples": [
                                            "anna@example.com"
                                        ]
                                    },
                                    "client_phone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 50,
                                        "pattern": "^[^<>]*$",
                                        "description": "The client's phone. Plain text."
                                    },
                                    "client_description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 2000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Subject / notes from the client. Plain text."
                                    },
                                    "location_preference": {
                                        "type": "string",
                                        "enum": [
                                            "office",
                                            "online"
                                        ],
                                        "description": "In-office or online consultation. Default \"office\".",
                                        "default": "office"
                                    },
                                    "meeting_link": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 500,
                                        "description": "Online-meeting URL (http/https), for an online consultation."
                                    },
                                    "gdpr_consent": {
                                        "type": "boolean",
                                        "description": "Record the client's data-handling consent. Default true (office staff books on the client's behalf).",
                                        "default": true
                                    },
                                    "auto_confirm": {
                                        "type": "boolean",
                                        "description": "When true (or the office has auto-confirm on), create the booking already confirmed: run the calendar sync and send the client a confirmation instead of a request. Otherwise it is pending.",
                                        "default": false
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "user_id",
                                    "date",
                                    "time",
                                    "client_name",
                                    "client_email"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "booking_number": {
                                                    "type": "string",
                                                    "description": "Human booking number, e.g. \"#B-0001\"."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "confirmed",
                                                        "cancelled",
                                                        "completed",
                                                        "awaiting_payment",
                                                        "expired"
                                                    ],
                                                    "description": "pending = awaiting the lawyer's confirmation; confirmed = approved; cancelled/completed; awaiting_payment/expired belong to the pay-before-confirm flow."
                                                },
                                                "source": {
                                                    "type": "string",
                                                    "enum": [
                                                        "flowyer",
                                                        "website",
                                                        "embed_widget",
                                                        "manual"
                                                    ],
                                                    "description": "Where the booking came from. An API-created booking is \"manual\"."
                                                },
                                                "lawyer": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The lawyer (user_id from colleagues.list) the appointment is with."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Calendar date in the booking time zone (YYYY-MM-DD), stored literally."
                                                },
                                                "start_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Start time HH:MM in the booking time zone."
                                                },
                                                "end_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "End time HH:MM in the booking time zone."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the start, composed with the booking time zone. Use this to compare instants across zones."
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the end."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "description": "The booking time zone (booking_settings.timezone), e.g. \"Europe/Budapest\". It governs date, start_time and end_time."
                                                },
                                                "location_preference": {
                                                    "type": "string",
                                                    "enum": [
                                                        "office",
                                                        "online"
                                                    ],
                                                    "description": "Whether the consultation is in the office or online."
                                                },
                                                "meeting_link": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Online-meeting URL, when set."
                                                },
                                                "client": {
                                                    "type": "object",
                                                    "properties": {
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "phone": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "description": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external client who booked: name, e-mail, phone and the subject/notes. Personal data — for office staff only."
                                                },
                                                "gdpr_consent": {
                                                    "type": "boolean",
                                                    "description": "Whether the client's data-handling consent is recorded."
                                                },
                                                "gdpr_consent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the consent was recorded."
                                                },
                                                "cancel_reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Reason recorded on cancellation."
                                                },
                                                "payment": {
                                                    "type": "object",
                                                    "properties": {
                                                        "status": {
                                                            "type": "string",
                                                            "enum": [
                                                                "none",
                                                                "awaiting",
                                                                "partial",
                                                                "paid",
                                                                "refunded"
                                                            ]
                                                        },
                                                        "method": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "card",
                                                                "transfer",
                                                                null
                                                            ]
                                                        },
                                                        "amount": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "invoice_number": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Read-only payment state. The API never changes payment; booking fees are handled in Flowyer."
                                                },
                                                "confirmed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "cancelled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to bookings.update / bookings.confirm / bookings.cancel as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the booking through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "booking_number": {
                                                    "type": "string",
                                                    "description": "Human booking number, e.g. \"#B-0001\"."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "confirmed",
                                                        "cancelled",
                                                        "completed",
                                                        "awaiting_payment",
                                                        "expired"
                                                    ],
                                                    "description": "pending = awaiting the lawyer's confirmation; confirmed = approved; cancelled/completed; awaiting_payment/expired belong to the pay-before-confirm flow."
                                                },
                                                "source": {
                                                    "type": "string",
                                                    "enum": [
                                                        "flowyer",
                                                        "website",
                                                        "embed_widget",
                                                        "manual"
                                                    ],
                                                    "description": "Where the booking came from. An API-created booking is \"manual\"."
                                                },
                                                "lawyer": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The lawyer (user_id from colleagues.list) the appointment is with."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Calendar date in the booking time zone (YYYY-MM-DD), stored literally."
                                                },
                                                "start_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Start time HH:MM in the booking time zone."
                                                },
                                                "end_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "End time HH:MM in the booking time zone."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the start, composed with the booking time zone. Use this to compare instants across zones."
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the end."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "description": "The booking time zone (booking_settings.timezone), e.g. \"Europe/Budapest\". It governs date, start_time and end_time."
                                                },
                                                "location_preference": {
                                                    "type": "string",
                                                    "enum": [
                                                        "office",
                                                        "online"
                                                    ],
                                                    "description": "Whether the consultation is in the office or online."
                                                },
                                                "meeting_link": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Online-meeting URL, when set."
                                                },
                                                "client": {
                                                    "type": "object",
                                                    "properties": {
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "phone": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "description": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external client who booked: name, e-mail, phone and the subject/notes. Personal data — for office staff only."
                                                },
                                                "gdpr_consent": {
                                                    "type": "boolean",
                                                    "description": "Whether the client's data-handling consent is recorded."
                                                },
                                                "gdpr_consent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the consent was recorded."
                                                },
                                                "cancel_reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Reason recorded on cancellation."
                                                },
                                                "payment": {
                                                    "type": "object",
                                                    "properties": {
                                                        "status": {
                                                            "type": "string",
                                                            "enum": [
                                                                "none",
                                                                "awaiting",
                                                                "partial",
                                                                "paid",
                                                                "refunded"
                                                            ]
                                                        },
                                                        "method": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "card",
                                                                "transfer",
                                                                null
                                                            ]
                                                        },
                                                        "amount": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "invoice_number": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Read-only payment state. The API never changes payment; booking fees are handled in Flowyer."
                                                },
                                                "confirmed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "cancelled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to bookings.update / bookings.confirm / bookings.cancel as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the booking through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/bookings/{id}": {
            "get": {
                "operationId": "bookings.get",
                "tags": [
                    "Bookings"
                ],
                "summary": "Get booking",
                "description": "Returns one appointment booking with the lawyer, the client's details, the start/end instants, payment state and the updated_at lock token for bookings.update / .confirm / .cancel. Answers 404 when the booking does not exist in this office.",
                "x-scope": "bookings:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                4321
                            ]
                        },
                        "description": "Booking id.",
                        "example": 4321
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "booking_number": {
                                                    "type": "string",
                                                    "description": "Human booking number, e.g. \"#B-0001\"."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "confirmed",
                                                        "cancelled",
                                                        "completed",
                                                        "awaiting_payment",
                                                        "expired"
                                                    ],
                                                    "description": "pending = awaiting the lawyer's confirmation; confirmed = approved; cancelled/completed; awaiting_payment/expired belong to the pay-before-confirm flow."
                                                },
                                                "source": {
                                                    "type": "string",
                                                    "enum": [
                                                        "flowyer",
                                                        "website",
                                                        "embed_widget",
                                                        "manual"
                                                    ],
                                                    "description": "Where the booking came from. An API-created booking is \"manual\"."
                                                },
                                                "lawyer": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The lawyer (user_id from colleagues.list) the appointment is with."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Calendar date in the booking time zone (YYYY-MM-DD), stored literally."
                                                },
                                                "start_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Start time HH:MM in the booking time zone."
                                                },
                                                "end_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "End time HH:MM in the booking time zone."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the start, composed with the booking time zone. Use this to compare instants across zones."
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the end."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "description": "The booking time zone (booking_settings.timezone), e.g. \"Europe/Budapest\". It governs date, start_time and end_time."
                                                },
                                                "location_preference": {
                                                    "type": "string",
                                                    "enum": [
                                                        "office",
                                                        "online"
                                                    ],
                                                    "description": "Whether the consultation is in the office or online."
                                                },
                                                "meeting_link": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Online-meeting URL, when set."
                                                },
                                                "client": {
                                                    "type": "object",
                                                    "properties": {
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "phone": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "description": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external client who booked: name, e-mail, phone and the subject/notes. Personal data — for office staff only."
                                                },
                                                "gdpr_consent": {
                                                    "type": "boolean",
                                                    "description": "Whether the client's data-handling consent is recorded."
                                                },
                                                "gdpr_consent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the consent was recorded."
                                                },
                                                "cancel_reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Reason recorded on cancellation."
                                                },
                                                "payment": {
                                                    "type": "object",
                                                    "properties": {
                                                        "status": {
                                                            "type": "string",
                                                            "enum": [
                                                                "none",
                                                                "awaiting",
                                                                "partial",
                                                                "paid",
                                                                "refunded"
                                                            ]
                                                        },
                                                        "method": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "card",
                                                                "transfer",
                                                                null
                                                            ]
                                                        },
                                                        "amount": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "invoice_number": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Read-only payment state. The API never changes payment; booking fees are handled in Flowyer."
                                                },
                                                "confirmed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "cancelled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to bookings.update / bookings.confirm / bookings.cancel as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the booking through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "bookings.update",
                "tags": [
                    "Bookings"
                ],
                "summary": "Update booking",
                "description": "Reschedules (date + time together, re-checked for a free slot) or edits a booking (phone, notes, meeting link, location). Writes only the fields you send. Notifies the lawyer of a reschedule, never the client. Pass expected_updated_at from your last read; a stale write answers 409.",
                "x-scope": "bookings:update",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "New day (YYYY-MM-DD) in the booking time zone. Send date AND time together to reschedule.",
                                        "examples": [
                                            "2026-03-05"
                                        ]
                                    },
                                    "time": {
                                        "type": "string",
                                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                        "description": "New start time HH:MM. The end time is recomputed from the office slot length. Send date AND time together.",
                                        "examples": [
                                            "11:00"
                                        ]
                                    },
                                    "client_phone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 50,
                                        "pattern": "^[^<>]*$",
                                        "description": "The client's phone. Plain text. \"\" clears it."
                                    },
                                    "client_description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 2000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Subject / notes. Plain text. \"\" clears it."
                                    },
                                    "meeting_link": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 500,
                                        "description": "Online-meeting URL (http/https). \"\" clears it."
                                    },
                                    "location_preference": {
                                        "type": "string",
                                        "enum": [
                                            "office",
                                            "online"
                                        ],
                                        "description": "In-office or online consultation."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "booking_number": {
                                                    "type": "string",
                                                    "description": "Human booking number, e.g. \"#B-0001\"."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "confirmed",
                                                        "cancelled",
                                                        "completed",
                                                        "awaiting_payment",
                                                        "expired"
                                                    ],
                                                    "description": "pending = awaiting the lawyer's confirmation; confirmed = approved; cancelled/completed; awaiting_payment/expired belong to the pay-before-confirm flow."
                                                },
                                                "source": {
                                                    "type": "string",
                                                    "enum": [
                                                        "flowyer",
                                                        "website",
                                                        "embed_widget",
                                                        "manual"
                                                    ],
                                                    "description": "Where the booking came from. An API-created booking is \"manual\"."
                                                },
                                                "lawyer": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The lawyer (user_id from colleagues.list) the appointment is with."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Calendar date in the booking time zone (YYYY-MM-DD), stored literally."
                                                },
                                                "start_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Start time HH:MM in the booking time zone."
                                                },
                                                "end_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "End time HH:MM in the booking time zone."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the start, composed with the booking time zone. Use this to compare instants across zones."
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the end."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "description": "The booking time zone (booking_settings.timezone), e.g. \"Europe/Budapest\". It governs date, start_time and end_time."
                                                },
                                                "location_preference": {
                                                    "type": "string",
                                                    "enum": [
                                                        "office",
                                                        "online"
                                                    ],
                                                    "description": "Whether the consultation is in the office or online."
                                                },
                                                "meeting_link": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Online-meeting URL, when set."
                                                },
                                                "client": {
                                                    "type": "object",
                                                    "properties": {
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "phone": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "description": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external client who booked: name, e-mail, phone and the subject/notes. Personal data — for office staff only."
                                                },
                                                "gdpr_consent": {
                                                    "type": "boolean",
                                                    "description": "Whether the client's data-handling consent is recorded."
                                                },
                                                "gdpr_consent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the consent was recorded."
                                                },
                                                "cancel_reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Reason recorded on cancellation."
                                                },
                                                "payment": {
                                                    "type": "object",
                                                    "properties": {
                                                        "status": {
                                                            "type": "string",
                                                            "enum": [
                                                                "none",
                                                                "awaiting",
                                                                "partial",
                                                                "paid",
                                                                "refunded"
                                                            ]
                                                        },
                                                        "method": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "card",
                                                                "transfer",
                                                                null
                                                            ]
                                                        },
                                                        "amount": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "invoice_number": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Read-only payment state. The API never changes payment; booking fees are handled in Flowyer."
                                                },
                                                "confirmed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "cancelled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to bookings.update / bookings.confirm / bookings.cancel as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the booking through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/bookings/{id}/cancel": {
            "post": {
                "operationId": "bookings.cancel",
                "tags": [
                    "Bookings"
                ],
                "summary": "Cancel booking",
                "description": "Cancels a booking and EMAILS THE CLIENT (and the lawyer) the cancellation. A booking already cancelled or completed answers 409, so a retry never re-emails. A paid booking is cancelled but never refunded (the office handles that). Optionally pass expected_updated_at.",
                "x-scope": "bookings:send",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                4321
                            ]
                        },
                        "description": "Booking id.",
                        "example": 4321
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "Optional optimistic-lock token: the updated_at from your last read. If the booking changed since, the API answers 409."
                                    },
                                    "reason": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "Reason recorded as cancel_reason and shown in the cancellation e-mail. Plain text; \"<\" and \">\" are not allowed."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "booking_number": {
                                                    "type": "string",
                                                    "description": "Human booking number, e.g. \"#B-0001\"."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "confirmed",
                                                        "cancelled",
                                                        "completed",
                                                        "awaiting_payment",
                                                        "expired"
                                                    ],
                                                    "description": "pending = awaiting the lawyer's confirmation; confirmed = approved; cancelled/completed; awaiting_payment/expired belong to the pay-before-confirm flow."
                                                },
                                                "source": {
                                                    "type": "string",
                                                    "enum": [
                                                        "flowyer",
                                                        "website",
                                                        "embed_widget",
                                                        "manual"
                                                    ],
                                                    "description": "Where the booking came from. An API-created booking is \"manual\"."
                                                },
                                                "lawyer": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The lawyer (user_id from colleagues.list) the appointment is with."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Calendar date in the booking time zone (YYYY-MM-DD), stored literally."
                                                },
                                                "start_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Start time HH:MM in the booking time zone."
                                                },
                                                "end_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "End time HH:MM in the booking time zone."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the start, composed with the booking time zone. Use this to compare instants across zones."
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the end."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "description": "The booking time zone (booking_settings.timezone), e.g. \"Europe/Budapest\". It governs date, start_time and end_time."
                                                },
                                                "location_preference": {
                                                    "type": "string",
                                                    "enum": [
                                                        "office",
                                                        "online"
                                                    ],
                                                    "description": "Whether the consultation is in the office or online."
                                                },
                                                "meeting_link": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Online-meeting URL, when set."
                                                },
                                                "client": {
                                                    "type": "object",
                                                    "properties": {
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "phone": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "description": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external client who booked: name, e-mail, phone and the subject/notes. Personal data — for office staff only."
                                                },
                                                "gdpr_consent": {
                                                    "type": "boolean",
                                                    "description": "Whether the client's data-handling consent is recorded."
                                                },
                                                "gdpr_consent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the consent was recorded."
                                                },
                                                "cancel_reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Reason recorded on cancellation."
                                                },
                                                "payment": {
                                                    "type": "object",
                                                    "properties": {
                                                        "status": {
                                                            "type": "string",
                                                            "enum": [
                                                                "none",
                                                                "awaiting",
                                                                "partial",
                                                                "paid",
                                                                "refunded"
                                                            ]
                                                        },
                                                        "method": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "card",
                                                                "transfer",
                                                                null
                                                            ]
                                                        },
                                                        "amount": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "invoice_number": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Read-only payment state. The API never changes payment; booking fees are handled in Flowyer."
                                                },
                                                "confirmed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "cancelled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to bookings.update / bookings.confirm / bookings.cancel as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the booking through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/bookings/{id}/confirm": {
            "post": {
                "operationId": "bookings.confirm",
                "tags": [
                    "Bookings"
                ],
                "summary": "Confirm booking",
                "description": "Confirms a pending booking and EMAILS THE CLIENT the confirmation (with the meeting link for an online one). Only a pending booking can be confirmed; any other status answers 409, so a retry never re-emails. Optionally pass expected_updated_at as a lock token.",
                "x-scope": "bookings:send",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                4321
                            ]
                        },
                        "description": "Booking id.",
                        "example": 4321
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "Optional optimistic-lock token: the updated_at from your last read. If the booking changed since, the API answers 409 and you re-read before retrying."
                                    },
                                    "meeting_link": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 500,
                                        "description": "Online-meeting URL (http/https) to set on the booking before the confirmation e-mail goes out."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "booking_number": {
                                                    "type": "string",
                                                    "description": "Human booking number, e.g. \"#B-0001\"."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "confirmed",
                                                        "cancelled",
                                                        "completed",
                                                        "awaiting_payment",
                                                        "expired"
                                                    ],
                                                    "description": "pending = awaiting the lawyer's confirmation; confirmed = approved; cancelled/completed; awaiting_payment/expired belong to the pay-before-confirm flow."
                                                },
                                                "source": {
                                                    "type": "string",
                                                    "enum": [
                                                        "flowyer",
                                                        "website",
                                                        "embed_widget",
                                                        "manual"
                                                    ],
                                                    "description": "Where the booking came from. An API-created booking is \"manual\"."
                                                },
                                                "lawyer": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The lawyer (user_id from colleagues.list) the appointment is with."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Calendar date in the booking time zone (YYYY-MM-DD), stored literally."
                                                },
                                                "start_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Start time HH:MM in the booking time zone."
                                                },
                                                "end_time": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "End time HH:MM in the booking time zone."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the start, composed with the booking time zone. Use this to compare instants across zones."
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Unambiguous ISO 8601 instant of the end."
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "description": "The booking time zone (booking_settings.timezone), e.g. \"Europe/Budapest\". It governs date, start_time and end_time."
                                                },
                                                "location_preference": {
                                                    "type": "string",
                                                    "enum": [
                                                        "office",
                                                        "online"
                                                    ],
                                                    "description": "Whether the consultation is in the office or online."
                                                },
                                                "meeting_link": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Online-meeting URL, when set."
                                                },
                                                "client": {
                                                    "type": "object",
                                                    "properties": {
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "phone": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "description": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external client who booked: name, e-mail, phone and the subject/notes. Personal data — for office staff only."
                                                },
                                                "gdpr_consent": {
                                                    "type": "boolean",
                                                    "description": "Whether the client's data-handling consent is recorded."
                                                },
                                                "gdpr_consent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the consent was recorded."
                                                },
                                                "cancel_reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Reason recorded on cancellation."
                                                },
                                                "payment": {
                                                    "type": "object",
                                                    "properties": {
                                                        "status": {
                                                            "type": "string",
                                                            "enum": [
                                                                "none",
                                                                "awaiting",
                                                                "partial",
                                                                "paid",
                                                                "refunded"
                                                            ]
                                                        },
                                                        "method": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "enum": [
                                                                "card",
                                                                "transfer",
                                                                null
                                                            ]
                                                        },
                                                        "amount": {
                                                            "type": [
                                                                "number",
                                                                "null"
                                                            ]
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "invoice_number": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Read-only payment state. The API never changes payment; booking fees are handled in Flowyer."
                                                },
                                                "confirmed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "cancelled_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to bookings.update / bookings.confirm / bookings.cancel as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the booking through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/calendar/events": {
            "get": {
                "operationId": "calendar.events.list",
                "tags": [
                    "Calendar"
                ],
                "summary": "List calendar events",
                "description": "Lists calendar events overlapping a [from, to] date range: the office calendar, your own and calendars shared with you. Recurring events are returned once (is_recurring), NOT expanded. Ordered by start. A personal event not shared with you never appears.",
                "x-scope": "calendar:read",
                "x-flowyer-module": "calendar-office:read",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "examples": [
                                "2026-03-01T00:00:00+01:00"
                            ]
                        },
                        "description": "Range start (inclusive), ISO 8601. Events overlapping [from, to] are returned. A time with no offset is read in the office zone.",
                        "example": "2026-03-01T00:00:00+01:00"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "examples": [
                                "2026-03-31T23:59:59+01:00"
                            ]
                        },
                        "description": "Range end (inclusive), ISO 8601. Must be on or after `from` (else 422) and at most 366 days after it.",
                        "example": "2026-03-31T23:59:59+01:00"
                    },
                    {
                        "name": "calendar_ids",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "integer",
                                "minimum": 1
                            }
                        },
                        "description": "Narrow to these container calendar ids; each is intersected with the calendars you may view, so an id you cannot see is silently dropped. Omit for every visible calendar."
                    },
                    {
                        "name": "include_recurring",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        },
                        "description": "Include recurring master events whose rule overlaps the range (returned un-expanded, is_recurring = true). Default true."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            5501
                                                        ]
                                                    },
                                                    "calendar": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ],
                                                                "description": "Container calendar id, or null for the implicit shared office calendar (a legacy event with no container)."
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "office",
                                                                    "personal"
                                                                ],
                                                                "description": "\"office\" = the shared office calendar (every office user may view and edit it); \"personal\" = a user's own calendar, visible only to its owner and those it is shared with."
                                                            },
                                                            "owner": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "user_id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    }
                                                                },
                                                                "additionalProperties": false,
                                                                "description": "Owner of a personal calendar; null for the office calendar."
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The calendar the event belongs to."
                                                    },
                                                    "title": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Event title. Plain text."
                                                    },
                                                    "description": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Event description. Plain text."
                                                    },
                                                    "location": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Location. Plain text."
                                                    },
                                                    "participants": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Participants, free text. Plain text."
                                                    },
                                                    "start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "An all-day event: the start date \"YYYY-MM-DD\". A timed event: ISO 8601 in the office time zone (the stored UTC instant).",
                                                        "examples": [
                                                            "2026-03-02T09:00:00+01:00"
                                                        ]
                                                    },
                                                    "end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Same encoding as start. For an all-day event the end date is INCLUSIVE (the stored value, not the +1-day value a calendar grid uses). Null when the event has no end."
                                                    },
                                                    "all_day": {
                                                        "type": "boolean",
                                                        "description": "True for an all-day event (start/end are bare dates); false for a timed event (start/end are ISO 8601 instants)."
                                                    },
                                                    "color": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display colour, e.g. \"#2c7be5\"."
                                                    },
                                                    "is_recurring": {
                                                        "type": "boolean",
                                                        "description": "True when the event is a recurring master. Recurring events are returned once, NOT expanded into occurrences, and cannot be modified through calendar.events.update."
                                                    },
                                                    "recurrence": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "freq": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "description": "daily | weekly | monthly | yearly."
                                                            },
                                                            "interval": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "byweekday": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "description": "Comma-separated weekday codes (e.g. \"MO,WE,FR\")."
                                                            },
                                                            "until": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "count": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The recurrence rule of a recurring master, or null for a single event. Read-only."
                                                    },
                                                    "created_by": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The colleague who created the event."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Pass this to calendar.events.update as expected_updated_at."
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Present when an external agent created the record through this API."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "calendar.events.create",
                "tags": [
                    "Calendar"
                ],
                "summary": "Create calendar event",
                "description": "Creates a single calendar event (timed or all-day) on the office calendar or a calendar you may edit. A timed start/end honours an ISO 8601 offset, a naive time is read in the office zone; an all-day end date is inclusive. Recurring events are not created here. Not pushed to external calendars.",
                "x-scope": "calendar:create",
                "x-flowyer-module": "calendar-office:create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "Event title. Plain text; \"<\" and \">\" are not allowed (it flows unescaped into the reminder notification).",
                                        "examples": [
                                            "Ügyfél egyeztetés"
                                        ]
                                    },
                                    "start": {
                                        "type": "string",
                                        "description": "All-day (all_day true): a date \"YYYY-MM-DD\". Timed (all_day false): ISO 8601; an offset is honoured, a naive time is read in the office zone.",
                                        "examples": [
                                            "2026-03-02T09:00:00+01:00"
                                        ]
                                    },
                                    "end": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Same encoding as start. Default = start. For an all-day event the end date is INCLUSIVE. Must not be before start (else 422)."
                                    },
                                    "all_day": {
                                        "type": "boolean",
                                        "description": "Whether the event is all-day. Default false (timed).",
                                        "default": false
                                    },
                                    "calendar_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Target container calendar; default = the office calendar. You must hold edit rights on it (else 403). Only on a tenant with the personal-calendar feature."
                                    },
                                    "location": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Location. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 10000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Description, plain text (not HTML); \"<\" and \">\" are not allowed."
                                    },
                                    "participants": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Participants, free text. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "color": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 32,
                                        "pattern": "^#?[A-Za-z0-9_-]{1,31}$",
                                        "description": "Display colour, e.g. \"#2c7be5\"."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "title",
                                    "start"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        5501
                                                    ]
                                                },
                                                "calendar": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ],
                                                            "description": "Container calendar id, or null for the implicit shared office calendar (a legacy event with no container)."
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "type": {
                                                            "type": "string",
                                                            "enum": [
                                                                "office",
                                                                "personal"
                                                            ],
                                                            "description": "\"office\" = the shared office calendar (every office user may view and edit it); \"personal\" = a user's own calendar, visible only to its owner and those it is shared with."
                                                        },
                                                        "owner": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "user_id": {
                                                                    "type": "integer"
                                                                },
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "Owner of a personal calendar; null for the office calendar."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The calendar the event belongs to."
                                                },
                                                "title": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event title. Plain text."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event description. Plain text."
                                                },
                                                "location": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Location. Plain text."
                                                },
                                                "participants": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Participants, free text. Plain text."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "An all-day event: the start date \"YYYY-MM-DD\". A timed event: ISO 8601 in the office time zone (the stored UTC instant).",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Same encoding as start. For an all-day event the end date is INCLUSIVE (the stored value, not the +1-day value a calendar grid uses). Null when the event has no end."
                                                },
                                                "all_day": {
                                                    "type": "boolean",
                                                    "description": "True for an all-day event (start/end are bare dates); false for a timed event (start/end are ISO 8601 instants)."
                                                },
                                                "color": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display colour, e.g. \"#2c7be5\"."
                                                },
                                                "is_recurring": {
                                                    "type": "boolean",
                                                    "description": "True when the event is a recurring master. Recurring events are returned once, NOT expanded into occurrences, and cannot be modified through calendar.events.update."
                                                },
                                                "recurrence": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "freq": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "daily | weekly | monthly | yearly."
                                                        },
                                                        "interval": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "byweekday": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "Comma-separated weekday codes (e.g. \"MO,WE,FR\")."
                                                        },
                                                        "until": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "count": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The recurrence rule of a recurring master, or null for a single event. Read-only."
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who created the event."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to calendar.events.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        5501
                                                    ]
                                                },
                                                "calendar": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ],
                                                            "description": "Container calendar id, or null for the implicit shared office calendar (a legacy event with no container)."
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "type": {
                                                            "type": "string",
                                                            "enum": [
                                                                "office",
                                                                "personal"
                                                            ],
                                                            "description": "\"office\" = the shared office calendar (every office user may view and edit it); \"personal\" = a user's own calendar, visible only to its owner and those it is shared with."
                                                        },
                                                        "owner": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "user_id": {
                                                                    "type": "integer"
                                                                },
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "Owner of a personal calendar; null for the office calendar."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The calendar the event belongs to."
                                                },
                                                "title": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event title. Plain text."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event description. Plain text."
                                                },
                                                "location": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Location. Plain text."
                                                },
                                                "participants": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Participants, free text. Plain text."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "An all-day event: the start date \"YYYY-MM-DD\". A timed event: ISO 8601 in the office time zone (the stored UTC instant).",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Same encoding as start. For an all-day event the end date is INCLUSIVE (the stored value, not the +1-day value a calendar grid uses). Null when the event has no end."
                                                },
                                                "all_day": {
                                                    "type": "boolean",
                                                    "description": "True for an all-day event (start/end are bare dates); false for a timed event (start/end are ISO 8601 instants)."
                                                },
                                                "color": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display colour, e.g. \"#2c7be5\"."
                                                },
                                                "is_recurring": {
                                                    "type": "boolean",
                                                    "description": "True when the event is a recurring master. Recurring events are returned once, NOT expanded into occurrences, and cannot be modified through calendar.events.update."
                                                },
                                                "recurrence": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "freq": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "daily | weekly | monthly | yearly."
                                                        },
                                                        "interval": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "byweekday": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "Comma-separated weekday codes (e.g. \"MO,WE,FR\")."
                                                        },
                                                        "until": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "count": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The recurrence rule of a recurring master, or null for a single event. Read-only."
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who created the event."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to calendar.events.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/calendar/events/{id}": {
            "get": {
                "operationId": "calendar.events.get",
                "tags": [
                    "Calendar"
                ],
                "summary": "Get calendar event",
                "description": "Returns one calendar event with its calendar, recurrence summary and the updated_at lock token for calendar.events.update. Answers 404 when the event does not exist or its calendar is not visible to the user.",
                "x-scope": "calendar:read",
                "x-flowyer-module": "calendar-office:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                5501
                            ]
                        },
                        "description": "Event id.",
                        "example": 5501
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        5501
                                                    ]
                                                },
                                                "calendar": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ],
                                                            "description": "Container calendar id, or null for the implicit shared office calendar (a legacy event with no container)."
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "type": {
                                                            "type": "string",
                                                            "enum": [
                                                                "office",
                                                                "personal"
                                                            ],
                                                            "description": "\"office\" = the shared office calendar (every office user may view and edit it); \"personal\" = a user's own calendar, visible only to its owner and those it is shared with."
                                                        },
                                                        "owner": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "user_id": {
                                                                    "type": "integer"
                                                                },
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "Owner of a personal calendar; null for the office calendar."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The calendar the event belongs to."
                                                },
                                                "title": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event title. Plain text."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event description. Plain text."
                                                },
                                                "location": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Location. Plain text."
                                                },
                                                "participants": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Participants, free text. Plain text."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "An all-day event: the start date \"YYYY-MM-DD\". A timed event: ISO 8601 in the office time zone (the stored UTC instant).",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Same encoding as start. For an all-day event the end date is INCLUSIVE (the stored value, not the +1-day value a calendar grid uses). Null when the event has no end."
                                                },
                                                "all_day": {
                                                    "type": "boolean",
                                                    "description": "True for an all-day event (start/end are bare dates); false for a timed event (start/end are ISO 8601 instants)."
                                                },
                                                "color": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display colour, e.g. \"#2c7be5\"."
                                                },
                                                "is_recurring": {
                                                    "type": "boolean",
                                                    "description": "True when the event is a recurring master. Recurring events are returned once, NOT expanded into occurrences, and cannot be modified through calendar.events.update."
                                                },
                                                "recurrence": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "freq": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "daily | weekly | monthly | yearly."
                                                        },
                                                        "interval": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "byweekday": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "Comma-separated weekday codes (e.g. \"MO,WE,FR\")."
                                                        },
                                                        "until": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "count": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The recurrence rule of a recurring master, or null for a single event. Read-only."
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who created the event."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to calendar.events.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "calendar.events.update",
                "tags": [
                    "Calendar"
                ],
                "summary": "Update calendar event",
                "description": "Updates a single calendar event: title, start/end, all_day, location, description, participants, colour. Writes only the fields you send; \"\" clears location/description/participants. A recurring event answers 422. Pass expected_updated_at from your last read; a conflicting change answers 409.",
                "x-scope": "calendar:update",
                "x-flowyer-module": "calendar-office:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "title": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "New title. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "start": {
                                        "type": "string",
                                        "description": "New start. All-day: \"YYYY-MM-DD\". Timed: ISO 8601 (an offset honoured, a naive time read in the office zone). Re-encoded if all_day changes."
                                    },
                                    "end": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "New end, same encoding as start; \"\" clears it. For an all-day event the end date is inclusive. Must not be before start (else 422)."
                                    },
                                    "all_day": {
                                        "type": "boolean",
                                        "description": "If sent, start/end are re-encoded accordingly; if omitted, the row's current all_day is used."
                                    },
                                    "location": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Location. Plain text; \"<\" and \">\" are not allowed. \"\" clears it."
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 10000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Description, plain text (not HTML); \"<\" and \">\" are not allowed. \"\" clears it."
                                    },
                                    "participants": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Participants, free text. Plain text; \"<\" and \">\" are not allowed. \"\" clears it."
                                    },
                                    "color": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 32,
                                        "pattern": "^#?[A-Za-z0-9_-]{1,31}$",
                                        "description": "Display colour, e.g. \"#2c7be5\". \"\" clears it."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        5501
                                                    ]
                                                },
                                                "calendar": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ],
                                                            "description": "Container calendar id, or null for the implicit shared office calendar (a legacy event with no container)."
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "type": {
                                                            "type": "string",
                                                            "enum": [
                                                                "office",
                                                                "personal"
                                                            ],
                                                            "description": "\"office\" = the shared office calendar (every office user may view and edit it); \"personal\" = a user's own calendar, visible only to its owner and those it is shared with."
                                                        },
                                                        "owner": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "user_id": {
                                                                    "type": "integer"
                                                                },
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "Owner of a personal calendar; null for the office calendar."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The calendar the event belongs to."
                                                },
                                                "title": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event title. Plain text."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Event description. Plain text."
                                                },
                                                "location": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Location. Plain text."
                                                },
                                                "participants": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Participants, free text. Plain text."
                                                },
                                                "start": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "An all-day event: the start date \"YYYY-MM-DD\". A timed event: ISO 8601 in the office time zone (the stored UTC instant).",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "end": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Same encoding as start. For an all-day event the end date is INCLUSIVE (the stored value, not the +1-day value a calendar grid uses). Null when the event has no end."
                                                },
                                                "all_day": {
                                                    "type": "boolean",
                                                    "description": "True for an all-day event (start/end are bare dates); false for a timed event (start/end are ISO 8601 instants)."
                                                },
                                                "color": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display colour, e.g. \"#2c7be5\"."
                                                },
                                                "is_recurring": {
                                                    "type": "boolean",
                                                    "description": "True when the event is a recurring master. Recurring events are returned once, NOT expanded into occurrences, and cannot be modified through calendar.events.update."
                                                },
                                                "recurrence": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "freq": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "daily | weekly | monthly | yearly."
                                                        },
                                                        "interval": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "byweekday": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "Comma-separated weekday codes (e.g. \"MO,WE,FR\")."
                                                        },
                                                        "until": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "count": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The recurrence rule of a recurring master, or null for a single event. Read-only."
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who created the event."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to calendar.events.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/clients": {
            "get": {
                "operationId": "clients.list",
                "tags": [
                    "Clients"
                ],
                "summary": "List clients",
                "description": "Lists the office's clients (persons and companies), alphabetically; `q` searches the name (accents and case ignored), e-mail and tax number. Before creating a client, check the name with clients.resolve (it tolerates typos too). Archived clients are hidden unless `include_archived` is true.",
                "x-scope": "clients:read",
                "x-flowyer-module": "contacts:read",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 100,
                            "examples": [
                                "Kovács"
                            ]
                        },
                        "description": "Search in name (accents and case ignored), e-mail and tax number.",
                        "example": "Kovács"
                    },
                    {
                        "name": "is_person",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        },
                        "description": "true = natural persons only, false = companies only."
                    },
                    {
                        "name": "include_archived",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "default": false
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Client id. Use it as `client_id` elsewhere.",
                                                        "examples": [
                                                            512
                                                        ]
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "examples": [
                                                            "Kovács Kft."
                                                        ]
                                                    },
                                                    "is_person": {
                                                        "type": "boolean",
                                                        "description": "True for a natural person, false for a company."
                                                    },
                                                    "email": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "phone": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "archived": {
                                                        "type": "boolean"
                                                    },
                                                    "recorded_by_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "recorded_by": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "clients.create",
                "tags": [
                    "Clients"
                ],
                "summary": "Create client",
                "description": "Creates a client (person or company), recorded as created by the key's user. Check the name with clients.resolve first (it tolerates missing accents and typos): a 409 only catches an active client of the very same name, unless `allow_duplicate_name` is true. ID numbers and fees cannot be set.",
                "x-scope": "clients:create",
                "x-flowyer-module": "contacts:create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 2,
                                        "pattern": "^[^<>]*$",
                                        "description": "Full name of the person or the company name. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Kovács Kft."
                                        ]
                                    },
                                    "is_person": {
                                        "type": "boolean",
                                        "description": "true for a natural person, false (default) for a company.",
                                        "default": false
                                    },
                                    "email": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 190,
                                        "examples": [
                                            "info@kovacskft.hu"
                                        ]
                                    },
                                    "phone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 64,
                                        "examples": [
                                            "+36 1 234 5678"
                                        ]
                                    },
                                    "address": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "properties": {
                                            "zip": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 20
                                            },
                                            "city": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 100
                                            },
                                            "street": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 255
                                            }
                                        },
                                        "additionalProperties": false,
                                        "description": "Registered / home address."
                                    },
                                    "mailing_address": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "properties": {
                                            "zip": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 20
                                            },
                                            "city": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 100
                                            },
                                            "street": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 255
                                            }
                                        },
                                        "additionalProperties": false
                                    },
                                    "tax_number": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 64,
                                        "description": "Company tax number (companies only).",
                                        "examples": [
                                            "12345678-2-41"
                                        ]
                                    },
                                    "company_registration_number": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 64,
                                        "description": "Company registration number (companies only).",
                                        "examples": [
                                            "01-09-123456"
                                        ]
                                    },
                                    "representative_name": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "description": "Companies only."
                                    },
                                    "representative_position": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "description": "Companies only."
                                    },
                                    "main_activity": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "description": "Main scope of activity (companies only)."
                                    },
                                    "nationality_country": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 100
                                    },
                                    "note": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 4000
                                    },
                                    "allow_duplicate_name": {
                                        "type": "boolean",
                                        "description": "Create even if an active client with the same name exists.",
                                        "default": false
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Client id. Use it as `client_id` elsewhere.",
                                                    "examples": [
                                                        512
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft."
                                                    ]
                                                },
                                                "is_person": {
                                                    "type": "boolean",
                                                    "description": "True for a natural person, false for a company."
                                                },
                                                "email": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "phone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "archived": {
                                                    "type": "boolean"
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "mailing_address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "tax_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "company_registration_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_position": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "main_activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Main scope of activity. Companies only; null for a natural person."
                                                },
                                                "nationality_country": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "note": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Client id. Use it as `client_id` elsewhere.",
                                                    "examples": [
                                                        512
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft."
                                                    ]
                                                },
                                                "is_person": {
                                                    "type": "boolean",
                                                    "description": "True for a natural person, false for a company."
                                                },
                                                "email": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "phone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "archived": {
                                                    "type": "boolean"
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "mailing_address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "tax_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "company_registration_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_position": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "main_activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Main scope of activity. Companies only; null for a natural person."
                                                },
                                                "nationality_country": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "note": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "An active client with the same name exists (`client_exists`, or `client_exists_generic` without the clients:read scope, when the existing client may not be named; pass allow_duplicate_name to override), the Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed (`duplicate_in_progress`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/clients/resolve": {
            "get": {
                "operationId": "clients.resolve",
                "tags": [
                    "Clients"
                ],
                "summary": "Resolve client by name",
                "description": "Finds a client by a spoken or misspelled name (accents, casing and small typos tolerated). Returns status exact/similar/none and candidate clients. Only \"exact\" is safe to use directly; on \"similar\" or \"none\" ask the user. A name with many lookalikes is never \"exact\": ask for a fuller name.",
                "x-scope": "clients:read",
                "x-flowyer-module": "contacts:read",
                "parameters": [
                    {
                        "name": "name",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "maxLength": 255,
                            "minLength": 1,
                            "examples": [
                                "Józsi ingatlan"
                            ]
                        },
                        "description": "Client name to look up, as heard or dictated.",
                        "example": "Józsi ingatlan"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10,
                            "default": 5
                        },
                        "description": "Maximum candidates to return (default 5)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "exact",
                                                        "similar",
                                                        "none"
                                                    ],
                                                    "description": "exact = one confident match (safe to use its id). similar = one or more approximate matches, confirm with the user first. none = no match, ask the user."
                                                },
                                                "matches": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Client id. Use it as `client_id` elsewhere.",
                                                                "examples": [
                                                                    512
                                                                ]
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "examples": [
                                                                    "Kovács Kft."
                                                                ]
                                                            },
                                                            "is_person": {
                                                                "type": "boolean",
                                                                "description": "True for a natural person, false for a company."
                                                            },
                                                            "email": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "phone": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "archived": {
                                                                "type": "boolean"
                                                            },
                                                            "recorded_by_user_id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "recorded_by": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "created_at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            },
                                                            "updated_at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            },
                                                            "created_via_api": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "kind": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                            "key",
                                                                            "oauth"
                                                                        ],
                                                                        "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                                    },
                                                                    "key_id": {
                                                                        "type": "integer",
                                                                        "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                                    },
                                                                    "key_name": {
                                                                        "type": "string",
                                                                        "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                                    },
                                                                    "user_id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "user": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "at": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ],
                                                                        "format": "date-time"
                                                                    }
                                                                },
                                                                "additionalProperties": false
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Candidate clients, best match first."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "How many clients matched before the list was cut to `limit`."
                                                },
                                                "truncated": {
                                                    "type": "boolean",
                                                    "description": "True when more clients matched than were returned, or too many lookalikes existed to check them all; ask the user for a fuller name or raise `limit` rather than choosing from an incomplete list."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/clients/{id}": {
            "get": {
                "operationId": "clients.get",
                "tags": [
                    "Clients"
                ],
                "summary": "Get client",
                "description": "Returns one client with address and registration details. Identity-document numbers and fee settings are never returned.",
                "x-scope": "clients:read",
                "x-flowyer-module": "contacts:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                512
                            ]
                        },
                        "description": "Client id.",
                        "example": 512
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Client id. Use it as `client_id` elsewhere.",
                                                    "examples": [
                                                        512
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft."
                                                    ]
                                                },
                                                "is_person": {
                                                    "type": "boolean",
                                                    "description": "True for a natural person, false for a company."
                                                },
                                                "email": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "phone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "archived": {
                                                    "type": "boolean"
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "mailing_address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "tax_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "company_registration_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_position": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "main_activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Main scope of activity. Companies only; null for a natural person."
                                                },
                                                "nationality_country": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "note": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "clients.update",
                "tags": [
                    "Clients"
                ],
                "summary": "Update client",
                "description": "Changes a client's contact fields (name, email, phone, address, note, nationality, and company representative/activity). ID numbers, tax numbers, fees and the person/company type are not editable here. Pass expected_updated_at; a conflicting change answers 409.",
                "x-scope": "clients:update",
                "x-flowyer-module": "contacts:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "name": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "Full name or company name. Plain text, at most 255 characters as a NEW value; \"<\" and \">\" cannot be introduced either, but a stored name that is longer or contains them may be sent back unchanged. null keeps the current name."
                                    },
                                    "email": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 190
                                    },
                                    "phone": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 64
                                    },
                                    "address": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "properties": {
                                            "zip": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 20
                                            },
                                            "city": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 100
                                            },
                                            "street": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 255
                                            }
                                        },
                                        "additionalProperties": false,
                                        "description": "Registered / home address."
                                    },
                                    "mailing_address": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "properties": {
                                            "zip": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 20
                                            },
                                            "city": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 100
                                            },
                                            "street": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "maxLength": 255
                                            }
                                        },
                                        "additionalProperties": false
                                    },
                                    "representative_name": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "description": "Companies only."
                                    },
                                    "representative_position": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "description": "Companies only."
                                    },
                                    "main_activity": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "description": "Main scope of activity (companies only)."
                                    },
                                    "nationality_country": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 100
                                    },
                                    "note": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Free-text note, at most 4000 characters as a NEW value; a longer stored note may be sent back unchanged. null clears the note."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Client id. Use it as `client_id` elsewhere.",
                                                    "examples": [
                                                        512
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft."
                                                    ]
                                                },
                                                "is_person": {
                                                    "type": "boolean",
                                                    "description": "True for a natural person, false for a company."
                                                },
                                                "email": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "phone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "archived": {
                                                    "type": "boolean"
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "mailing_address": {
                                                    "type": "object",
                                                    "properties": {
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 20
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 100
                                                        },
                                                        "street": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "maxLength": 255
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "tax_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "company_registration_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "representative_position": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Companies only; null for a natural person."
                                                },
                                                "main_activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Main scope of activity. Companies only; null for a natural person."
                                                },
                                                "nationality_country": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "note": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/colleagues": {
            "get": {
                "operationId": "colleagues.list",
                "tags": [
                    "Colleagues"
                ],
                "summary": "List colleagues",
                "description": "Lists the active colleagues of the office (id, name) for assigned_to_user_id / responsible_user_id. With `q` (a name as heard; accents, casing and small typos tolerated) answers status exact/similar/none like the resolve tools: only \"exact\" is safe to use directly.",
                "x-scope": "colleagues:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 255,
                            "examples": [
                                "Nagy Péter"
                            ]
                        },
                        "description": "A colleague's name to look up, as heard or dictated, in any word order. Omit it to list every active colleague.",
                        "example": "Nagy Péter"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 500,
                            "default": 200
                        },
                        "description": "Maximum colleagues to return (default 200)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "exact",
                                                        "similar",
                                                        "none",
                                                        null
                                                    ],
                                                    "description": "Only with `q`: exact = one confident match (safe to use its id), similar = approximate or several matches (confirm with the user first), none = no match (ask the user). Null without `q`."
                                                },
                                                "colleagues": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "User id: pass it as assigned_to_user_id / responsible_user_id."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "description": "Display name as Flowyer shows it (with the title, if any)."
                                                            },
                                                            "title": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "description": "Name prefix such as \"Dr.\", or null."
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Active colleagues, best match first with `q`, otherwise by name."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "How many colleagues matched (all active colleagues without `q`) before the list was cut to `limit`."
                                                },
                                                "truncated": {
                                                    "type": "boolean",
                                                    "description": "True when more colleagues matched than were returned: narrow `q` or raise `limit`."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/comments/{id}": {
            "patch": {
                "operationId": "comments.update",
                "tags": [
                    "Comments"
                ],
                "summary": "Edit own matter comment",
                "description": "Edits one of your OWN comments (its body only; rich HTML, server-side sanitised before store). Pass expected_updated_at from your last read; a conflicting change answers 409. Answers 404 for a comment that is not yours or on a matter you cannot see.",
                "x-scope": "comments:update",
                "x-flowyer-module": "cases:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "body": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "New comment body, rich HTML (as TinyMCE produces). Server-side HTMLPurifier-cleaned before store. At most 100000 characters.",
                                        "examples": [
                                            "<p>Pontosítás: a határidő november 15.</p>"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "body"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "matter_id": {
                                                    "type": "integer",
                                                    "description": "The matter (= case_id) the comment belongs to."
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The top-level comment this replies to; null for a top-level comment. Replies are one level deep."
                                                },
                                                "author_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the author (null for a legacy import)."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the author, or null."
                                                },
                                                "body": {
                                                    "type": "string",
                                                    "description": "The comment as stored: rich HTML, already HTMLPurifier-cleaned for comments written through this API."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the comment was posted, ISO 8601 in the office zone."
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Optimistic-lock token: pass it to comments.update as expected_updated_at. Not a display time; null for a legacy comment without one."
                                                },
                                                "edited": {
                                                    "type": "boolean",
                                                    "description": "True when the comment has been edited since it was posted."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/costs": {
            "get": {
                "operationId": "costs.list",
                "tags": [
                    "Costs"
                ],
                "summary": "List costs",
                "description": "Lists the live costs of matters the user may see, newest first (an invoiced cost is no longer here). Filter by matter, responsible colleague or date range. Amounts are net. Rows flagged excluded: true are out of the summary and rows flagged locked: true are managed by Flowyer.",
                "x-scope": "costs:read",
                "x-flowyer-module": "cases:read, summary:read",
                "parameters": [
                    {
                        "name": "matter_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Only costs on this matter.",
                        "example": 1234
                    },
                    {
                        "name": "responsible_user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Only costs recorded for this colleague (a user id from colleagues.list)."
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Only costs on or after this date (YYYY-MM-DD)."
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Only costs on or before this date (YYYY-MM-DD)."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Cost id."
                                                    },
                                                    "matter_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Matter the cost belongs to."
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "activity": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Description of the cost (plain text)."
                                                    },
                                                    "cost": {
                                                        "type": [
                                                            "number",
                                                            "null"
                                                        ],
                                                        "description": "Net cost amount (no VAT)."
                                                    },
                                                    "cost_invoiceable": {
                                                        "type": [
                                                            "number",
                                                            "null"
                                                        ],
                                                        "description": "Net amount to bill on to the client. It counts towards billing only while excluded is false."
                                                    },
                                                    "currency_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Currency id (Flowyer currency list)."
                                                    },
                                                    "currency": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Currency ISO code, e.g. HUF, EUR."
                                                    },
                                                    "responsible_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "responsible": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "excluded": {
                                                        "type": "boolean",
                                                        "description": "True when a colleague excluded the cost from the matter summary: it is not billed and is left out of the billable totals."
                                                    },
                                                    "locked": {
                                                        "type": "boolean",
                                                        "description": "True when the cost is managed by Flowyer - mirrored from an incoming invoice, or a disbursement surcharge - and cannot be changed through the API (costs.update answers 409 record_locked, details.reason says which)."
                                                    },
                                                    "approved_for_billing": {
                                                        "type": "boolean",
                                                        "description": "True when a colleague approved the cost for billing in the matter summary. It stays editable through the API (as in the web), and the approval is NOT re-requested afterwards: say so before changing the amount of an approved cost."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Send this back as expected_updated_at when updating."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "costs.create",
                "tags": [
                    "Costs"
                ],
                "summary": "Record cost",
                "description": "Records a cost (disbursement) on a matter: date, text (`subject`, read back as `activity`), net amount, net amount billed to the client, and currency (default: the office currency). Amounts are net (no VAT). The responsible colleague defaults to the key's user and is notified otherwise.",
                "x-scope": "costs:create",
                "x-flowyer-module": "cases:create, summary:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "matter_id": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Matter the cost belongs to (must be visible).",
                                        "examples": [
                                            1234
                                        ]
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Date of the cost, YYYY-MM-DD.",
                                        "examples": [
                                            "2026-10-30"
                                        ]
                                    },
                                    "subject": {
                                        "type": "string",
                                        "maxLength": 1000,
                                        "minLength": 2,
                                        "pattern": "^[^<>]*$",
                                        "description": "Description of the cost; the read side returns it as `activity` and either name is accepted here (one of the two is required). Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Court filing fee"
                                        ]
                                    },
                                    "activity": {
                                        "type": "string",
                                        "maxLength": 1000,
                                        "minLength": 2,
                                        "pattern": "^[^<>]*$",
                                        "description": "The same field as `subject`, under the name the read side uses. Send one of the two."
                                    },
                                    "cost": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 2147483647,
                                        "description": "Net cost amount (no VAT), a whole number in the currency's main unit (cents are not stored).",
                                        "examples": [
                                            15000
                                        ]
                                    },
                                    "cost_invoiceable": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 2147483647,
                                        "description": "Net amount to bill on to the client, a whole number (omit if not billed). It counts towards billing only while the cost is not excluded from the summary.",
                                        "examples": [
                                            15000
                                        ]
                                    },
                                    "currency_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Currency id from the Flowyer currency list (not an ISO code). Omit it to use the office currency (GET /me `office.currency_id` / `office.currency`); an unknown id answers 422 with the accepted ids and codes in details.allowed."
                                    },
                                    "responsible_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Responsible colleague: a user id from colleagues.list (look a dictated name up there). Default: the user behind the key."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "matter_id",
                                    "date",
                                    "cost"
                                ],
                                "anyOf": [
                                    {
                                        "required": [
                                            "subject"
                                        ]
                                    },
                                    {
                                        "required": [
                                            "activity"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Cost id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the cost belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Description of the cost (plain text)."
                                                },
                                                "cost": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net cost amount (no VAT)."
                                                },
                                                "cost_invoiceable": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net amount to bill on to the client. It counts towards billing only while excluded is false."
                                                },
                                                "currency_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Currency id (Flowyer currency list)."
                                                },
                                                "currency": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Currency ISO code, e.g. HUF, EUR."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the cost from the matter summary: it is not billed and is left out of the billable totals."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the cost is managed by Flowyer - mirrored from an incoming invoice, or a disbursement surcharge - and cannot be changed through the API (costs.update answers 409 record_locked, details.reason says which)."
                                                },
                                                "approved_for_billing": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague approved the cost for billing in the matter summary. It stays editable through the API (as in the web), and the approval is NOT re-requested afterwards: say so before changing the amount of an approved cost."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Cost id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the cost belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Description of the cost (plain text)."
                                                },
                                                "cost": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net cost amount (no VAT)."
                                                },
                                                "cost_invoiceable": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net amount to bill on to the client. It counts towards billing only while excluded is false."
                                                },
                                                "currency_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Currency id (Flowyer currency list)."
                                                },
                                                "currency": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Currency ISO code, e.g. HUF, EUR."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the cost from the matter summary: it is not billed and is left out of the billable totals."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the cost is managed by Flowyer - mirrored from an incoming invoice, or a disbursement surcharge - and cannot be changed through the API (costs.update answers 409 record_locked, details.reason says which)."
                                                },
                                                "approved_for_billing": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague approved the cost for billing in the matter summary. It stays editable through the API (as in the web), and the approval is NOT re-requested afterwards: say so before changing the amount of an approved cost."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/costs/{id}": {
            "get": {
                "operationId": "costs.get",
                "tags": [
                    "Costs"
                ],
                "summary": "Get cost",
                "description": "Returns one live cost by id, if its matter is visible to the user. Amounts are net.",
                "x-scope": "costs:read",
                "x-flowyer-module": "cases:read, summary:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Cost id."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Cost id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the cost belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Description of the cost (plain text)."
                                                },
                                                "cost": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net cost amount (no VAT)."
                                                },
                                                "cost_invoiceable": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net amount to bill on to the client. It counts towards billing only while excluded is false."
                                                },
                                                "currency_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Currency id (Flowyer currency list)."
                                                },
                                                "currency": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Currency ISO code, e.g. HUF, EUR."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the cost from the matter summary: it is not billed and is left out of the billable totals."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the cost is managed by Flowyer - mirrored from an incoming invoice, or a disbursement surcharge - and cannot be changed through the API (costs.update answers 409 record_locked, details.reason says which)."
                                                },
                                                "approved_for_billing": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague approved the cost for billing in the matter summary. It stays editable through the API (as in the web), and the approval is NOT re-requested afterwards: say so before changing the amount of an approved cost."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "costs.update",
                "tags": [
                    "Costs"
                ],
                "summary": "Update cost",
                "description": "Changes a live cost: text (`subject`, read back as `activity`), date, net amounts, currency and the responsible colleague. A cost flagged locked: true cannot be changed (409 record_locked, details.reason). Pass expected_updated_at; a conflicting change answers 409.",
                "x-scope": "costs:update",
                "x-flowyer-module": "cases:modify, summary:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "date": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "Date of the cost, YYYY-MM-DD. null keeps the current date."
                                    },
                                    "subject": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "Description of the cost, the value the read side returns as `activity` (either name is accepted; null under one of them is \"not given\", only two different texts are refused). Plain text, at most 1000 characters as a NEW value; \"<\" and \">\" cannot be introduced either, but a stored text that is longer or contains them may be sent back unchanged. null keeps the current text."
                                    },
                                    "activity": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "The same field as `subject`, under the name the read side uses. Send one of the two (null under the other one is fine)."
                                    },
                                    "cost": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 2147483647,
                                        "description": "Net cost amount (no VAT), a whole number in the currency's main unit (cents are not stored). null clears the amount."
                                    },
                                    "cost_invoiceable": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 2147483647,
                                        "description": "Net amount to bill on to the client, a whole number; null clears it. It counts towards billing only while the cost is not excluded from the summary (excluded is false)."
                                    },
                                    "currency_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "description": "Currency id from the Flowyer currency list (not an ISO code; the office currency is GET /me `office.currency_id`). An unknown id answers 422 with the accepted ids and codes in details.allowed. null - or the 0 an unset legacy cost reads back as - keeps the current currency."
                                    },
                                    "responsible_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "description": "New responsible colleague: an active colleague's user id from colleagues.list. Sending the current one - or null / 0, which a cost without a responsible reads back as - changes nothing."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Cost id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the cost belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Description of the cost (plain text)."
                                                },
                                                "cost": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net cost amount (no VAT)."
                                                },
                                                "cost_invoiceable": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ],
                                                    "description": "Net amount to bill on to the client. It counts towards billing only while excluded is false."
                                                },
                                                "currency_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Currency id (Flowyer currency list)."
                                                },
                                                "currency": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Currency ISO code, e.g. HUF, EUR."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the cost from the matter summary: it is not billed and is left out of the billable totals."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the cost is managed by Flowyer - mirrored from an incoming invoice, or a disbursement surcharge - and cannot be changed through the API (costs.update answers 409 record_locked, details.reason says which)."
                                                },
                                                "approved_for_billing": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague approved the cost for billing in the matter summary. It stays editable through the API (as in the web), and the approval is NOT re-requested afterwards: say so before changing the amount of an approved cost."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at), or it has been invoiced / locked and can no longer be modified through the API (`record_locked`; make the change in Flowyer).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/courts": {
            "get": {
                "operationId": "courts.list",
                "tags": [
                    "Courts"
                ],
                "summary": "List courts",
                "description": "Lists the shared court registry (id, name, city) for the court_id of trials.create / trials.update. With `q` (a court name as heard; accents, casing and small typos tolerated) answers status exact/similar/none: only \"exact\" is safe to use directly. It is the Hungarian court directory.",
                "x-scope": "courts:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 255,
                            "examples": [
                                "Fővárosi Törvényszék"
                            ]
                        },
                        "description": "A court name to look up, as heard or dictated, in any word order. Omit it to list every court.",
                        "example": "Fővárosi Törvényszék"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 500,
                            "default": 200
                        },
                        "description": "Maximum courts to return (default 200)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "exact",
                                                        "similar",
                                                        "none",
                                                        null
                                                    ],
                                                    "description": "Only with `q`: exact = one confident match (safe to use its id), similar = approximate or several matches (confirm with the user first), none = no match (ask the user). Null without `q`."
                                                },
                                                "courts": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Court id: pass it as court_id to trials.create / trials.update."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "description": "Court name as shown in Flowyer."
                                                            },
                                                            "city": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "zip": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "address": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Courts, best match first with `q`, otherwise by name."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "How many courts matched (all courts without `q`) before the list was cut to `limit`."
                                                },
                                                "truncated": {
                                                    "type": "boolean",
                                                    "description": "True when more courts matched than were returned: narrow `q` or raise `limit`."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/documents/{id}": {
            "patch": {
                "operationId": "documents.rename",
                "tags": [
                    "Documents"
                ],
                "summary": "Rename document",
                "description": "Renames a document (its display name only; the file content is unchanged). The new name must be unique in the same folder of the matter. Pass expected_updated_at from your last read; a conflicting change answers 409.",
                "x-scope": "documents:update",
                "x-flowyer-module": "cases:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "New file name, at most 255 characters INCLUDING the extension. The current extension is kept if you omit one, and it counts towards the 255 (so an extension-less name for \"Beadvany.pdf\" may be at most 251 characters). Plain text; \"<\" and \">\" are not allowed, so a document whose stored name contains one can only be renamed in Flowyer.",
                                        "examples": [
                                            "Contract_signed.pdf"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "File name as shown in Flowyer: the name stored with the document, or its storage name when it was imported from an older system without one. documents.list is ordered by the stored name: documents that have one come first, alphabetically, then the imported ones without a stored name, oldest first (the order they were filed in Flowyer), which are therefore not sorted by the name shown here. The order is the same on every page, so limit and offset page through the list without repeats or gaps.",
                                                    "examples": [
                                                        "Contract_v2.docx"
                                                    ]
                                                },
                                                "size": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Bytes."
                                                },
                                                "version": {
                                                    "type": "integer",
                                                    "description": "Current version number of the file."
                                                },
                                                "folder": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "path": {
                                                            "type": "string",
                                                            "description": "Folder path inside the matter, \"/\" separated."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The folder the document is filed in, or null at the matter root. documents.upload.complete answers null when the folder chosen at documents.upload.init was deleted while the bytes were uploading: the document is then filed at the matter root, which is where Flowyer shows it. If the root already holds a document of that name, the upload is filed under a suffixed name (\"Contract_2.pdf\") instead of becoming a new version of that unrelated document; the 201 echoes the stored `name`."
                                                },
                                                "folder_deleted": {
                                                    "type": "boolean",
                                                    "description": "True when the document is filed in a folder that no longer exists, which Flowyer's own file list does not show (`folder` is null for it, as it is for a document at the matter root). documents.upload.complete answers true only if the folder was deleted while the bytes were uploading AND moving the stored file to the matter root failed: the document is then kept in the deleted folder, where its contents are still reachable. False for everything else, a normal root filing included."
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at), or another document in the same folder already has this name (`duplicate_name`; choose another name, do not retry the same one).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/documents/{id}/download": {
            "get": {
                "operationId": "documents.download",
                "tags": [
                    "Documents"
                ],
                "summary": "Download document",
                "description": "Returns a short-lived signed URL to download one document by id, if its matter is visible. GET the url to fetch the bytes; it expires in a few minutes.",
                "x-scope": "documents:download",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Document id (from documents.list)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "download_url": {
                                                    "type": "string",
                                                    "description": "Signed URL. GET it to download the file bytes."
                                                },
                                                "filename": {
                                                    "type": "string",
                                                    "description": "File name for the download."
                                                },
                                                "size": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Bytes."
                                                },
                                                "expires_in": {
                                                    "type": "integer",
                                                    "description": "Seconds until the URL expires."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/emails/{id}": {
            "get": {
                "operationId": "emails.get",
                "tags": [
                    "Emails"
                ],
                "summary": "Get email",
                "description": "Returns one saved email of a matter with its plain-text body (sender, subject, size and who saved it). The raw HTML body is never returned. Answers 404 when the email does not exist or its matter is not visible to the user who owns this API key.",
                "x-scope": "emails:read",
                "x-flowyer-module": "emails:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Email id.",
                        "example": 1234
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        1234
                                                    ]
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the mail is filed under, or null for a caseless mail (saved outside any case)."
                                                },
                                                "from_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the outside party (never a colleague; the store has no direction column)."
                                                },
                                                "from_address": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "SMTP address of the outside party."
                                                },
                                                "subject": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "body": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "The message body as plain text. The raw HTML body is deliberately never returned (untrusted third-party HTML). Best-effort plain text: if the original HTML carried <style>/<script>, their inner text may survive into it."
                                                },
                                                "sent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the message was sent. Timezone is inconsistent by ingest path (IMAP stores UTC, the Outlook add-in an office-zone wall time); created_at is the reliable timestamp."
                                                },
                                                "size": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Bytes of the stored .eml/.msg file."
                                                },
                                                "extension": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "\"msg\" or \"eml\"; null on some legacy rows."
                                                },
                                                "saved_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the colleague who saved the mail into Flowyer."
                                                },
                                                "saved_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of that colleague."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the mail was saved into Flowyer (office-zone wall time)."
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/folders/{id}": {
            "patch": {
                "operationId": "documents.folders.rename",
                "tags": [
                    "Documents"
                ],
                "summary": "Rename matter folder",
                "description": "Renames a folder (its name only; its files and subfolders keep their place). The name is plain text (\"<\" and \">\" are not allowed). Pass expected_updated_at from your last read (documents.folders lists it); a conflicting change answers 409.",
                "x-scope": "documents:update",
                "x-flowyer-module": "cases:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "New folder name, at most 255 characters. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Beadványok"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Folder id: pass it as folder_id to documents.upload.init, or as parent_id to documents.folders.create."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Folder name as shown in Flowyer."
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Id of the parent folder; null for a folder at the matter root."
                                                },
                                                "path": {
                                                    "type": "string",
                                                    "description": "Folder path inside the matter, \"/\" separated, e.g. \"/Iratok/Beadványok\"."
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to documents.folders.rename as expected_updated_at."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/hr/leaves": {
            "get": {
                "operationId": "hr.leaves.list",
                "tags": [
                    "Hr"
                ],
                "summary": "List staff leaves",
                "description": "Lists approved staff leaves (who is or will be on leave): the colleague, start/end dates, working-day count, a privacy-redacted category (leave/unpaid; sick is merged into leave and never identifiable) and any substitute. Never returns the leave type, notes or who approved it.",
                "x-scope": "hr:read",
                "x-flowyer-module": "hr-admin:read",
                "parameters": [
                    {
                        "name": "user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Only this colleague's leaves. A central user id (from colleagues.list), matched to the employee behind the leave.",
                        "example": 1234
                    },
                    {
                        "name": "on_date",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Who is on leave on this exact day (start_date <= on_date <= end_date). When set, it overrides date_from, date_to and timeframe."
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Only leaves still running on or after this date (end_date >= date_from). Defaults to today, so fully past leaves are excluded by default."
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Only leaves starting on or before this date (start_date <= date_to). Omit for open-ended future."
                    },
                    {
                        "name": "timeframe",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "current",
                                "upcoming",
                                "all"
                            ],
                            "default": "all"
                        },
                        "description": "Extra start-date constraint versus today: current = already started (ongoing), upcoming = not yet started, all = no extra. Ignored when on_date is set."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Leave request id (a handle only; not sensitive)."
                                                    },
                                                    "user_id": {
                                                        "type": "integer",
                                                        "description": "The colleague on leave (central user id)."
                                                    },
                                                    "user": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "The colleague's display name."
                                                    },
                                                    "start_date": {
                                                        "type": "string",
                                                        "format": "date",
                                                        "description": "First day of leave (YYYY-MM-DD)."
                                                    },
                                                    "end_date": {
                                                        "type": "string",
                                                        "format": "date",
                                                        "description": "Last day of leave, inclusive (YYYY-MM-DD)."
                                                    },
                                                    "days_count": {
                                                        "type": [
                                                            "number",
                                                            "null"
                                                        ],
                                                        "description": "Working days of leave. Does not reveal the type."
                                                    },
                                                    "category": {
                                                        "type": "string",
                                                        "enum": [
                                                            "leave",
                                                            "unpaid"
                                                        ],
                                                        "description": "Privacy-redacted leave type: annual and sick both become \"leave\" (sick is never identifiable), unpaid stays \"unpaid\". The raw leave type is never exposed."
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "approved"
                                                        ],
                                                        "description": "Always \"approved\" - only approved leaves are returned; pending, rejected and cancelled never surface."
                                                    },
                                                    "substitute_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Covering colleague for this leave (central user id), or null."
                                                    },
                                                    "substitute_user": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Covering colleague's display name, or null."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invoices": {
            "get": {
                "operationId": "invoices.list",
                "tags": [
                    "Invoices"
                ],
                "summary": "List invoices",
                "description": "Lists invoices (issued and received), newest issue date first. direction=outgoing is the office's issued-invoice list and leaves proformas out (direction=proforma lists those). Read-only: invoices cannot be created or changed through the API. Invoices of matters the user may not see are hidden.",
                "x-scope": "invoices:read",
                "x-flowyer-module": "invoices:read, summary:read",
                "parameters": [
                    {
                        "name": "direction",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "incoming",
                                "outgoing",
                                "proforma"
                            ]
                        },
                        "description": "The office's own three lists: outgoing = invoices issued by the office, proformas excluded (a legacy row with no document type counts as an invoice, as in the office dashboard); proforma = payment requests (díjbekérő) issued by the office; incoming = received."
                    },
                    {
                        "name": "paid_status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "unpaid",
                                "paid",
                                "partially_paid",
                                "cancelled"
                            ]
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "matter_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "issued_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-01-01"
                            ]
                        },
                        "description": "Issue date on or after.",
                        "example": "2026-01-01"
                    },
                    {
                        "name": "issued_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-12-31"
                            ]
                        },
                        "description": "Issue date on or before.",
                        "example": "2026-12-31"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            301
                                                        ]
                                                    },
                                                    "invoice_number": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "examples": [
                                                            "FLW-2026-0042"
                                                        ]
                                                    },
                                                    "direction": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "enum": [
                                                            "incoming",
                                                            "outgoing",
                                                            null
                                                        ],
                                                        "description": "outgoing = issued by the office, incoming = received by the office."
                                                    },
                                                    "document_type": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "enum": [
                                                            "invoice",
                                                            "proforma",
                                                            "receipt",
                                                            null
                                                        ],
                                                        "description": "\"proforma\" is a request for payment, not an issued invoice: it is not revenue and must not be counted with the issued ones. invoices.list direction=outgoing leaves proformas out, direction=proforma lists them. Null on a legacy row, which counts as an invoice."
                                                    },
                                                    "source": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "enum": [
                                                            "manual",
                                                            "szamlazz_outgoing",
                                                            "szamlazz_imported",
                                                            null
                                                        ]
                                                    },
                                                    "paid_status": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "enum": [
                                                            "unpaid",
                                                            "paid",
                                                            "partially_paid",
                                                            "cancelled",
                                                            null
                                                        ]
                                                    },
                                                    "issued_date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "due_date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "paid_date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "completion_date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "net_amount": {
                                                        "type": [
                                                            "number",
                                                            "null"
                                                        ]
                                                    },
                                                    "gross_amount": {
                                                        "type": [
                                                            "number",
                                                            "null"
                                                        ]
                                                    },
                                                    "currency": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "examples": [
                                                            "HUF"
                                                        ]
                                                    },
                                                    "payment_method_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "payment_method": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Localized name of the payment method (e.g. bank transfer); English when the office language has no translation for it, null when the method has no name at all. Identify the method by payment_method_id."
                                                    },
                                                    "supplier": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Issuer of an incoming invoice."
                                                    },
                                                    "client": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "matter_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invoices/{id}": {
            "get": {
                "operationId": "invoices.get",
                "tags": [
                    "Invoices"
                ],
                "summary": "Get invoice",
                "description": "Returns one invoice. Read-only. Answers 404 when it does not exist or belongs to a matter the user may not see.",
                "x-scope": "invoices:read",
                "x-flowyer-module": "invoices:read, summary:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                301
                            ]
                        },
                        "description": "Invoice id.",
                        "example": 301
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        301
                                                    ]
                                                },
                                                "invoice_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "examples": [
                                                        "FLW-2026-0042"
                                                    ]
                                                },
                                                "direction": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "incoming",
                                                        "outgoing",
                                                        null
                                                    ],
                                                    "description": "outgoing = issued by the office, incoming = received by the office."
                                                },
                                                "document_type": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "invoice",
                                                        "proforma",
                                                        "receipt",
                                                        null
                                                    ],
                                                    "description": "\"proforma\" is a request for payment, not an issued invoice: it is not revenue and must not be counted with the issued ones. invoices.list direction=outgoing leaves proformas out, direction=proforma lists them. Null on a legacy row, which counts as an invoice."
                                                },
                                                "source": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "manual",
                                                        "szamlazz_outgoing",
                                                        "szamlazz_imported",
                                                        null
                                                    ]
                                                },
                                                "paid_status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "unpaid",
                                                        "paid",
                                                        "partially_paid",
                                                        "cancelled",
                                                        null
                                                    ]
                                                },
                                                "issued_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "due_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "paid_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "completion_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "net_amount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "gross_amount": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "currency": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "examples": [
                                                        "HUF"
                                                    ]
                                                },
                                                "payment_method_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "payment_method": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized name of the payment method (e.g. bank transfer); English when the office language has no translation for it, null when the method has no name at all. Identify the method by payment_method_id."
                                                },
                                                "supplier": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Issuer of an incoming invoice."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "notes": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "received_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "sent_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "proforma_invoice_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/knowledge/articles": {
            "get": {
                "operationId": "knowledge.articles.list",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "List knowledge base articles",
                "description": "Lists knowledge-base articles the user may see (the author's own, global articles, and articles shared with the user's role). All statuses by default; filter by status, or pass `q` to full-text search titles, excerpts, content and tags.",
                "x-scope": "knowledge:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 255,
                            "examples": [
                                "felmondási idő"
                            ]
                        },
                        "description": "Full-text search term (titles, excerpts, content and tag names). Boolean operators are stripped.",
                        "example": "felmondási idő"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "enum": [
                                "draft",
                                "published",
                                "archived",
                                null
                            ]
                        },
                        "description": "Only articles with this status. Omit to list every status."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            9876
                                                        ]
                                                    },
                                                    "slug": {
                                                        "type": "string",
                                                        "description": "Server-generated URL slug.",
                                                        "examples": [
                                                            "felmondasi-ido"
                                                        ]
                                                    },
                                                    "title": {
                                                        "type": "string",
                                                        "examples": [
                                                            "Felmondási idő a munka törvénykönyvében"
                                                        ]
                                                    },
                                                    "excerpt": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Short summary (rich HTML, as stored). Use knowledge.articles.get for the full body."
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "draft",
                                                            "published",
                                                            "archived"
                                                        ]
                                                    },
                                                    "is_featured": {
                                                        "type": "boolean",
                                                        "description": "Whether the article is pinned to the KB home page (not settable through the API)."
                                                    },
                                                    "category_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "category_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "author_id": {
                                                        "type": "integer",
                                                        "description": "User id of the author; 0 for a global (default) article."
                                                    },
                                                    "author_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "editor_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "User id of the last editor, or null if never edited."
                                                    },
                                                    "editor_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "views_count": {
                                                        "type": "integer"
                                                    },
                                                    "downloads_count": {
                                                        "type": "integer"
                                                    },
                                                    "shared_roles": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "integer"
                                                        },
                                                        "description": "Role ids the article is shared with (empty = only the author/global)."
                                                    },
                                                    "tags": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        },
                                                        "description": "Tag names on the article."
                                                    },
                                                    "published_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "When the article was first published, or null."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "knowledge.articles.create",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "Create knowledge base article",
                "description": "Creates a knowledge-base article authored by the key's user. The slug is generated from the title. The category must exist and be active. Share it with roles via `shared_roles` (otherwise only the author sees it). `content` and `excerpt` are HTML and are sanitised server-side.",
                "x-scope": "knowledge:create",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "maxLength": 500,
                                        "description": "Article title. Plain text.",
                                        "examples": [
                                            "Felmondási idő a munka törvénykönyvében"
                                        ]
                                    },
                                    "excerpt": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Short summary (HTML allowed, sanitised server-side), at most 200 characters."
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "The article body. Rich HTML, sanitised server-side with the knowledge-base profile."
                                    },
                                    "category_id": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Id of an existing, active knowledge-base category.",
                                        "examples": [
                                            12
                                        ]
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "draft",
                                            "published",
                                            "archived"
                                        ],
                                        "description": "draft, published or archived. published stamps published_at."
                                    },
                                    "tags": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string",
                                            "maxLength": 100
                                        },
                                        "description": "Tag names; new tags are created as needed."
                                    },
                                    "shared_roles": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Role ids to share the article with. Empty means only the author can see it."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "title",
                                    "content",
                                    "category_id",
                                    "status"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "Server-generated URL slug.",
                                                    "examples": [
                                                        "felmondasi-ido"
                                                    ]
                                                },
                                                "title": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Felmondási idő a munka törvénykönyvében"
                                                    ]
                                                },
                                                "excerpt": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Short summary (rich HTML, as stored). Use knowledge.articles.get for the full body."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "draft",
                                                        "published",
                                                        "archived"
                                                    ]
                                                },
                                                "is_featured": {
                                                    "type": "boolean",
                                                    "description": "Whether the article is pinned to the KB home page (not settable through the API)."
                                                },
                                                "category_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "category_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the author; 0 for a global (default) article."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "editor_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the last editor, or null if never edited."
                                                },
                                                "editor_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "views_count": {
                                                    "type": "integer"
                                                },
                                                "downloads_count": {
                                                    "type": "integer"
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    },
                                                    "description": "Role ids the article is shared with (empty = only the author/global)."
                                                },
                                                "tags": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Tag names on the article."
                                                },
                                                "published_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the article was first published, or null."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "description": "The full article body as stored (rich HTML)."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "Server-generated URL slug.",
                                                    "examples": [
                                                        "felmondasi-ido"
                                                    ]
                                                },
                                                "title": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Felmondási idő a munka törvénykönyvében"
                                                    ]
                                                },
                                                "excerpt": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Short summary (rich HTML, as stored). Use knowledge.articles.get for the full body."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "draft",
                                                        "published",
                                                        "archived"
                                                    ]
                                                },
                                                "is_featured": {
                                                    "type": "boolean",
                                                    "description": "Whether the article is pinned to the KB home page (not settable through the API)."
                                                },
                                                "category_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "category_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the author; 0 for a global (default) article."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "editor_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the last editor, or null if never edited."
                                                },
                                                "editor_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "views_count": {
                                                    "type": "integer"
                                                },
                                                "downloads_count": {
                                                    "type": "integer"
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    },
                                                    "description": "Role ids the article is shared with (empty = only the author/global)."
                                                },
                                                "tags": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Tag names on the article."
                                                },
                                                "published_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the article was first published, or null."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "description": "The full article body as stored (rich HTML)."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/knowledge/articles/{id}": {
            "get": {
                "operationId": "knowledge.articles.get",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "Get knowledge base article",
                "description": "Returns one knowledge-base article, including its full content, tags and shared roles. Answers 404 when the article does not exist or the user may not see it.",
                "x-scope": "knowledge:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                9876
                            ]
                        },
                        "description": "Article id.",
                        "example": 9876
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "Server-generated URL slug.",
                                                    "examples": [
                                                        "felmondasi-ido"
                                                    ]
                                                },
                                                "title": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Felmondási idő a munka törvénykönyvében"
                                                    ]
                                                },
                                                "excerpt": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Short summary (rich HTML, as stored). Use knowledge.articles.get for the full body."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "draft",
                                                        "published",
                                                        "archived"
                                                    ]
                                                },
                                                "is_featured": {
                                                    "type": "boolean",
                                                    "description": "Whether the article is pinned to the KB home page (not settable through the API)."
                                                },
                                                "category_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "category_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the author; 0 for a global (default) article."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "editor_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the last editor, or null if never edited."
                                                },
                                                "editor_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "views_count": {
                                                    "type": "integer"
                                                },
                                                "downloads_count": {
                                                    "type": "integer"
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    },
                                                    "description": "Role ids the article is shared with (empty = only the author/global)."
                                                },
                                                "tags": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Tag names on the article."
                                                },
                                                "published_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the article was first published, or null."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "description": "The full article body as stored (rich HTML)."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "knowledge.articles.update",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "Update knowledge base article",
                "description": "Changes a knowledge-base article: title (the slug is re-derived), excerpt, content, category, status, tags or shared roles. Only the author (or anyone, for a global article) may edit. Pass expected_updated_at; a conflicting change answers 409. content and excerpt are sanitised server-side.",
                "x-scope": "knowledge:update",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "title": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Article title (plain text). null keeps the current title; a new title re-derives the slug."
                                    },
                                    "excerpt": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Short summary (HTML allowed, sanitised), at most 200 characters as a NEW value. Empty/null clears it; omit to keep it."
                                    },
                                    "content": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "The article body (rich HTML, sanitised). null keeps the current content; it cannot be cleared."
                                    },
                                    "category_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Move the article to this existing, active category. null keeps the current one."
                                    },
                                    "status": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "draft",
                                            "published",
                                            "archived",
                                            null
                                        ],
                                        "description": "draft, published or archived. The first switch to published stamps published_at; it is never cleared. null keeps the current status."
                                    },
                                    "tags": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string",
                                            "maxLength": 100
                                        },
                                        "description": "Replaces the whole tag set (new tags are created). An empty array clears all tags; omit to keep them."
                                    },
                                    "shared_roles": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Replaces the whole shared-role set. An empty array removes all sharing (only the author sees it); omit to keep it."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "Server-generated URL slug.",
                                                    "examples": [
                                                        "felmondasi-ido"
                                                    ]
                                                },
                                                "title": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Felmondási idő a munka törvénykönyvében"
                                                    ]
                                                },
                                                "excerpt": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Short summary (rich HTML, as stored). Use knowledge.articles.get for the full body."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "draft",
                                                        "published",
                                                        "archived"
                                                    ]
                                                },
                                                "is_featured": {
                                                    "type": "boolean",
                                                    "description": "Whether the article is pinned to the KB home page (not settable through the API)."
                                                },
                                                "category_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "category_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the author; 0 for a global (default) article."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "editor_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the last editor, or null if never edited."
                                                },
                                                "editor_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "views_count": {
                                                    "type": "integer"
                                                },
                                                "downloads_count": {
                                                    "type": "integer"
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer"
                                                    },
                                                    "description": "Role ids the article is shared with (empty = only the author/global)."
                                                },
                                                "tags": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Tag names on the article."
                                                },
                                                "published_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the article was first published, or null."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "content": {
                                                    "type": "string",
                                                    "description": "The full article body as stored (rich HTML)."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/knowledge/categories": {
            "get": {
                "operationId": "knowledge.categories.list",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "List knowledge base categories",
                "description": "Lists the knowledge base categories the user may see: built-in default categories, the user's own, and those shared with the user's role. Ordered as in Flowyer (sort position, then name).",
                "x-scope": "knowledge:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            42
                                                        ]
                                                    },
                                                    "slug": {
                                                        "type": "string",
                                                        "description": "URL slug, generated from the name.",
                                                        "examples": [
                                                            "munkajog"
                                                        ]
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "examples": [
                                                            "Munkajog"
                                                        ]
                                                    },
                                                    "description": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Plain-text description, or null."
                                                    },
                                                    "icon": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Icon identifier shown next to the category, or null."
                                                    },
                                                    "order_column": {
                                                        "type": "integer",
                                                        "description": "Sort position among sibling categories.",
                                                        "examples": [
                                                            0
                                                        ]
                                                    },
                                                    "is_active": {
                                                        "type": "boolean"
                                                    },
                                                    "parent_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Parent category id, or null for a root category."
                                                    },
                                                    "author_id": {
                                                        "type": "integer",
                                                        "description": "User id of the creator; 0 for a built-in default category visible to everyone."
                                                    },
                                                    "author_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of the creator, or null for a default category."
                                                    },
                                                    "articles_count": {
                                                        "type": "integer",
                                                        "description": "Number of published articles in this category that the caller may see."
                                                    },
                                                    "shared_roles": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "integer",
                                                            "minimum": 1
                                                        },
                                                        "description": "Role ids this category is shared with. Empty means only the author sees it (a default category with author_id 0 is visible to everyone)."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "knowledge.categories.create",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "Create knowledge base category",
                "description": "Creates a knowledge base category. The URL slug is generated from the name. Share it with roles via shared_roles, or omit them so only you (the author) can see it. A parent_id, when given, must be an existing active category.",
                "x-scope": "knowledge:create",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "Category name. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Munkajog"
                                        ]
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Optional description, plain text."
                                    },
                                    "parent_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Parent category id (must exist and be active). Omit for a root category."
                                    },
                                    "icon": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 100,
                                        "pattern": "^[^<>]*$",
                                        "description": "Optional icon identifier. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "is_active": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "Whether the category is active. Default true.",
                                        "default": true
                                    },
                                    "order_column": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "description": "Sort position among sibling categories. Default 0.",
                                        "examples": [
                                            0
                                        ]
                                    },
                                    "shared_roles": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Role ids to share this category with. Omit so only you (the author) can see it."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        42
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "URL slug, generated from the name.",
                                                    "examples": [
                                                        "munkajog"
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Munkajog"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Plain-text description, or null."
                                                },
                                                "icon": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Icon identifier shown next to the category, or null."
                                                },
                                                "order_column": {
                                                    "type": "integer",
                                                    "description": "Sort position among sibling categories.",
                                                    "examples": [
                                                        0
                                                    ]
                                                },
                                                "is_active": {
                                                    "type": "boolean"
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Parent category id, or null for a root category."
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the creator; 0 for a built-in default category visible to everyone."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the creator, or null for a default category."
                                                },
                                                "articles_count": {
                                                    "type": "integer",
                                                    "description": "Number of published articles in this category that the caller may see."
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer",
                                                        "minimum": 1
                                                    },
                                                    "description": "Role ids this category is shared with. Empty means only the author sees it (a default category with author_id 0 is visible to everyone)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        42
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "URL slug, generated from the name.",
                                                    "examples": [
                                                        "munkajog"
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Munkajog"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Plain-text description, or null."
                                                },
                                                "icon": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Icon identifier shown next to the category, or null."
                                                },
                                                "order_column": {
                                                    "type": "integer",
                                                    "description": "Sort position among sibling categories.",
                                                    "examples": [
                                                        0
                                                    ]
                                                },
                                                "is_active": {
                                                    "type": "boolean"
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Parent category id, or null for a root category."
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the creator; 0 for a built-in default category visible to everyone."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the creator, or null for a default category."
                                                },
                                                "articles_count": {
                                                    "type": "integer",
                                                    "description": "Number of published articles in this category that the caller may see."
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer",
                                                        "minimum": 1
                                                    },
                                                    "description": "Role ids this category is shared with. Empty means only the author sees it (a default category with author_id 0 is visible to everyone)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/knowledge/categories/{id}": {
            "get": {
                "operationId": "knowledge.categories.get",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "Get knowledge base category",
                "description": "Returns one knowledge base category. Answers 404 when the category does not exist or is not visible to the user who owns this API key.",
                "x-scope": "knowledge:read",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                42
                            ]
                        },
                        "description": "Category id.",
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        42
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "URL slug, generated from the name.",
                                                    "examples": [
                                                        "munkajog"
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Munkajog"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Plain-text description, or null."
                                                },
                                                "icon": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Icon identifier shown next to the category, or null."
                                                },
                                                "order_column": {
                                                    "type": "integer",
                                                    "description": "Sort position among sibling categories.",
                                                    "examples": [
                                                        0
                                                    ]
                                                },
                                                "is_active": {
                                                    "type": "boolean"
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Parent category id, or null for a root category."
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the creator; 0 for a built-in default category visible to everyone."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the creator, or null for a default category."
                                                },
                                                "articles_count": {
                                                    "type": "integer",
                                                    "description": "Number of published articles in this category that the caller may see."
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer",
                                                        "minimum": 1
                                                    },
                                                    "description": "Role ids this category is shared with. Empty means only the author sees it (a default category with author_id 0 is visible to everyone)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "knowledge.categories.update",
                "tags": [
                    "Knowledge base"
                ],
                "summary": "Update knowledge base category",
                "description": "Changes a knowledge base category: name (the slug follows), description, icon, parent, active flag, sort position or the roles it is shared with. Only the author may change it (a built-in default category is editable by anyone). Pass expected_updated_at; a conflicting change answers 409.",
                "x-scope": "knowledge:update",
                "x-flowyer-module": null,
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "name": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "Category name. At most 255 characters as a NEW value; \"<\" and \">\" cannot be introduced, but a stored name that is longer or contains them may be sent back unchanged. null keeps the current name."
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Plain-text description. null clears it."
                                    },
                                    "parent_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Move the category under this parent (must exist, be active and not create a cycle), or null to make it a root category."
                                    },
                                    "icon": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Icon identifier. At most 100 characters as a NEW value; \"<\" and \">\" cannot be introduced. null clears it."
                                    },
                                    "is_active": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "Active flag. Omit or null to keep the current value."
                                    },
                                    "order_column": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "description": "Sort position among sibling categories. Omit or null to keep the current value."
                                    },
                                    "shared_roles": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Replace the set of role ids this category is shared with. An empty array removes all sharing (only the author sees it). Omit to leave sharing unchanged."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        42
                                                    ]
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "description": "URL slug, generated from the name.",
                                                    "examples": [
                                                        "munkajog"
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Munkajog"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Plain-text description, or null."
                                                },
                                                "icon": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Icon identifier shown next to the category, or null."
                                                },
                                                "order_column": {
                                                    "type": "integer",
                                                    "description": "Sort position among sibling categories.",
                                                    "examples": [
                                                        0
                                                    ]
                                                },
                                                "is_active": {
                                                    "type": "boolean"
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Parent category id, or null for a root category."
                                                },
                                                "author_id": {
                                                    "type": "integer",
                                                    "description": "User id of the creator; 0 for a built-in default category visible to everyone."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the creator, or null for a default category."
                                                },
                                                "articles_count": {
                                                    "type": "integer",
                                                    "description": "Number of published articles in this category that the caller may see."
                                                },
                                                "shared_roles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "integer",
                                                        "minimum": 1
                                                    },
                                                    "description": "Role ids this category is shared with. Empty means only the author sees it (a default category with author_id 0 is visible to everyone)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/litigation/{id}": {
            "patch": {
                "operationId": "litigation.update",
                "tags": [
                    "Litigation"
                ],
                "summary": "Update litigation history entry",
                "description": "Changes a litigation-history entry (pertörténet): title, description, location or event date. Only the fields you send are written; the description is sanitised server-side. Pass expected_updated_at from your last read; a conflicting change answers 409.",
                "x-scope": "litigation:update",
                "x-flowyer-module": "cases:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "title": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 2000,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "New title, at most 2000 characters (plain text; \"<\"/\">\" not allowed). Omit to keep the current one.",
                                        "examples": [
                                            "Ítélethirdetés elhalasztva"
                                        ]
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "New details (rich HTML, sanitised). Omit to keep the current one; null/empty clears it."
                                    },
                                    "location": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "New location (plain text, at most 255 characters; \"<\"/\">\" not allowed). Omit to keep it; null/empty clears it."
                                    },
                                    "event_date": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "New event day, YYYY-MM-DD. Omit to keep it; null clears it."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4521
                                                    ]
                                                },
                                                "title": {
                                                    "type": "string",
                                                    "description": "Entry title. Plain text.",
                                                    "examples": [
                                                        "Első tárgyalás elhalasztva"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Entry details as rich HTML, sanitised server-side."
                                                },
                                                "location": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Where it happened (plain text), e.g. a court room; nullable."
                                                },
                                                "event_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day of the entry, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Author (the user who created the entry)."
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the author."
                                                },
                                                "last_editor_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User who last edited the entry."
                                                },
                                                "last_editor": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the last editor."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to litigation.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the entry through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mail-register": {
            "get": {
                "operationId": "mail_register.list",
                "tags": [
                    "Mail register"
                ],
                "summary": "List mail register",
                "description": "Lists the mail-register (Postakönyv) entries filed against the matters the user may see, newest first. Filter by matter, direction, free text (subject/sender/addressee/tracking number) and date range. Mail of archived matters is hidden unless include_archived is true.",
                "x-scope": "mail_register:read",
                "x-flowyer-module": "mail:read",
                "parameters": [
                    {
                        "name": "matter_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Only entries of this matter (must be visible to the user).",
                        "example": 1234
                    },
                    {
                        "name": "direction",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "incoming",
                                "outgoing"
                            ]
                        },
                        "description": "Only incoming (received) or outgoing (sent) entries."
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 100,
                            "examples": [
                                "Kúria"
                            ]
                        },
                        "description": "Free-text search over subject, sender, addressee, recipient and tracking number (case ignored).",
                        "example": "Kúria"
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-01-01"
                            ]
                        },
                        "description": "Only entries whose date is on or after this day (YYYY-MM-DD).",
                        "example": "2026-01-01"
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-12-31"
                            ]
                        },
                        "description": "Only entries whose date is on or before this day (YYYY-MM-DD).",
                        "example": "2026-12-31"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "examples": [
                                "2026-10-01T00:00:00+02:00"
                            ]
                        },
                        "description": "Only entries changed at or after this time (ISO 8601).",
                        "example": "2026-10-01T00:00:00+02:00"
                    },
                    {
                        "name": "include_archived",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "default": false
                        },
                        "description": "Include entries of archived matters."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Mail-register entry id (use with mail_register.get / .update).",
                                                        "examples": [
                                                            4321
                                                        ]
                                                    },
                                                    "matter": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "case_number": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The matter the entry is filed against."
                                                    },
                                                    "direction": {
                                                        "type": "string",
                                                        "enum": [
                                                            "incoming",
                                                            "outgoing"
                                                        ],
                                                        "description": "incoming = received, outgoing = sent."
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date",
                                                        "description": "Postal/recorded date, YYYY-MM-DD (no time of day)."
                                                    },
                                                    "subject": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "sender": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Feladó: the sender (free text)."
                                                    },
                                                    "to": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Címzett: the addressee (free text)."
                                                    },
                                                    "recipient": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "For an incoming mail: the display name of the colleague who received it. For an outgoing mail: the free-text addressee/received-by."
                                                    },
                                                    "recipient_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Set only for an incoming mail whose recipient is a colleague (a user id); null for an outgoing mail."
                                                    },
                                                    "electronic": {
                                                        "type": "boolean",
                                                        "description": "True when the item was recorded as electronic (type_of_mail)."
                                                    },
                                                    "delivery_method_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Id of the delivery method (mail_delivery_methods)."
                                                    },
                                                    "delivery_method": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Localized delivery-method label (Posta, Cégkapu, Perkapu, ...), or the electronic/non-electronic fallback for a legacy row."
                                                    },
                                                    "tracking_no": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Azonosító: tracking number."
                                                    },
                                                    "folder_path": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "recorded_by_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "The colleague who recorded the entry."
                                                    },
                                                    "recorded_by": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Pass this to mail_register.update as expected_updated_at."
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Present when an external agent created the entry through this API."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "mail_register.create",
                "tags": [
                    "Mail register"
                ],
                "summary": "Create mail register entry",
                "description": "Files a new mail-register (Postakönyv) entry on a matter. Use recipient_user_id for an incoming mail received by a colleague, or recipient (free text) for an outgoing one. delivery_method_id must be a known method. Answers 404 when the matter is not visible.",
                "x-scope": "mail_register:create",
                "x-flowyer-module": "mail:create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "matter_id": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Matter the entry belongs to (must be visible).",
                                        "examples": [
                                            1234
                                        ]
                                    },
                                    "direction": {
                                        "type": "string",
                                        "enum": [
                                            "incoming",
                                            "outgoing"
                                        ],
                                        "description": "incoming = received, outgoing = sent."
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Postal/recorded date, YYYY-MM-DD (no time of day).",
                                        "examples": [
                                            "2026-11-03"
                                        ]
                                    },
                                    "subject": {
                                        "type": "string",
                                        "maxLength": 1000,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "Subject of the correspondence. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Fellebbezés a Kúriához"
                                        ]
                                    },
                                    "sender": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Feladó: the sender (free text). Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "to": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Címzett: the addressee (free text). Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "recipient": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Outgoing mail: the free-text addressee/received-by. Not allowed together with recipient_user_id. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "recipient_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Incoming mail: the colleague who received it (a user id from colleagues.list), stored as the numeric recipient. Not allowed together with recipient."
                                    },
                                    "electronic": {
                                        "type": "boolean",
                                        "description": "Whether the item is electronic (type_of_mail); independent of the delivery method. Default false.",
                                        "default": false
                                    },
                                    "delivery_method_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Delivery method id (mail_delivery_methods): e.g. 1 Posta, 4 Cégkapu, 7 Perkapu. 422 when unknown."
                                    },
                                    "tracking_no": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "Azonosító: tracking number. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "folder_path": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$"
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "matter_id",
                                    "direction",
                                    "date",
                                    "subject"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Mail-register entry id (use with mail_register.get / .update).",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the entry is filed against."
                                                },
                                                "direction": {
                                                    "type": "string",
                                                    "enum": [
                                                        "incoming",
                                                        "outgoing"
                                                    ],
                                                    "description": "incoming = received, outgoing = sent."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Postal/recorded date, YYYY-MM-DD (no time of day)."
                                                },
                                                "subject": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "sender": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Feladó: the sender (free text)."
                                                },
                                                "to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Címzett: the addressee (free text)."
                                                },
                                                "recipient": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "For an incoming mail: the display name of the colleague who received it. For an outgoing mail: the free-text addressee/received-by."
                                                },
                                                "recipient_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Set only for an incoming mail whose recipient is a colleague (a user id); null for an outgoing mail."
                                                },
                                                "electronic": {
                                                    "type": "boolean",
                                                    "description": "True when the item was recorded as electronic (type_of_mail)."
                                                },
                                                "delivery_method_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Id of the delivery method (mail_delivery_methods)."
                                                },
                                                "delivery_method": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized delivery-method label (Posta, Cégkapu, Perkapu, ...), or the electronic/non-electronic fallback for a legacy row."
                                                },
                                                "tracking_no": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Azonosító: tracking number."
                                                },
                                                "folder_path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The colleague who recorded the entry."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to mail_register.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the entry through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Mail-register entry id (use with mail_register.get / .update).",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the entry is filed against."
                                                },
                                                "direction": {
                                                    "type": "string",
                                                    "enum": [
                                                        "incoming",
                                                        "outgoing"
                                                    ],
                                                    "description": "incoming = received, outgoing = sent."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Postal/recorded date, YYYY-MM-DD (no time of day)."
                                                },
                                                "subject": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "sender": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Feladó: the sender (free text)."
                                                },
                                                "to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Címzett: the addressee (free text)."
                                                },
                                                "recipient": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "For an incoming mail: the display name of the colleague who received it. For an outgoing mail: the free-text addressee/received-by."
                                                },
                                                "recipient_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Set only for an incoming mail whose recipient is a colleague (a user id); null for an outgoing mail."
                                                },
                                                "electronic": {
                                                    "type": "boolean",
                                                    "description": "True when the item was recorded as electronic (type_of_mail)."
                                                },
                                                "delivery_method_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Id of the delivery method (mail_delivery_methods)."
                                                },
                                                "delivery_method": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized delivery-method label (Posta, Cégkapu, Perkapu, ...), or the electronic/non-electronic fallback for a legacy row."
                                                },
                                                "tracking_no": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Azonosító: tracking number."
                                                },
                                                "folder_path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The colleague who recorded the entry."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to mail_register.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the entry through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mail-register/{id}": {
            "get": {
                "operationId": "mail_register.get",
                "tags": [
                    "Mail register"
                ],
                "summary": "Get mail register entry",
                "description": "Returns one mail-register (Postakönyv) entry by id, with its updated_at (the token mail_register.update takes). Answers 404 when the entry does not exist or its matter is not visible to the user.",
                "x-scope": "mail_register:read",
                "x-flowyer-module": "mail:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                4321
                            ]
                        },
                        "description": "Mail-register entry id.",
                        "example": 4321
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Mail-register entry id (use with mail_register.get / .update).",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the entry is filed against."
                                                },
                                                "direction": {
                                                    "type": "string",
                                                    "enum": [
                                                        "incoming",
                                                        "outgoing"
                                                    ],
                                                    "description": "incoming = received, outgoing = sent."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Postal/recorded date, YYYY-MM-DD (no time of day)."
                                                },
                                                "subject": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "sender": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Feladó: the sender (free text)."
                                                },
                                                "to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Címzett: the addressee (free text)."
                                                },
                                                "recipient": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "For an incoming mail: the display name of the colleague who received it. For an outgoing mail: the free-text addressee/received-by."
                                                },
                                                "recipient_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Set only for an incoming mail whose recipient is a colleague (a user id); null for an outgoing mail."
                                                },
                                                "electronic": {
                                                    "type": "boolean",
                                                    "description": "True when the item was recorded as electronic (type_of_mail)."
                                                },
                                                "delivery_method_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Id of the delivery method (mail_delivery_methods)."
                                                },
                                                "delivery_method": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized delivery-method label (Posta, Cégkapu, Perkapu, ...), or the electronic/non-electronic fallback for a legacy row."
                                                },
                                                "tracking_no": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Azonosító: tracking number."
                                                },
                                                "folder_path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The colleague who recorded the entry."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to mail_register.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the entry through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "mail_register.update",
                "tags": [
                    "Mail register"
                ],
                "summary": "Update mail register entry",
                "description": "Updates a mail-register (Postakönyv) entry; only the fields you send are changed. The entry stays on its matter. Pass expected_updated_at from your last read; a conflicting change answers 409. Answers 404 when the entry is not visible.",
                "x-scope": "mail_register:update",
                "x-flowyer-module": "mail:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "direction": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "incoming",
                                            "outgoing",
                                            null
                                        ],
                                        "description": "incoming = received, outgoing = sent."
                                    },
                                    "date": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "Postal/recorded date, YYYY-MM-DD."
                                    },
                                    "subject": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "Subject. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "sender": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Feladó: the sender (free text). Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "to": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Címzett: the addressee (free text). Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "recipient": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Outgoing mail: the free-text addressee. Not allowed together with recipient_user_id. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "recipient_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Incoming mail: the receiving colleague (a user id), stored as the numeric recipient. Not allowed together with recipient."
                                    },
                                    "electronic": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "Whether the item is electronic (type_of_mail)."
                                    },
                                    "delivery_method_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Delivery method id (mail_delivery_methods); 422 when unknown."
                                    },
                                    "tracking_no": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "Azonosító: tracking number. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "folder_path": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$"
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Mail-register entry id (use with mail_register.get / .update).",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the entry is filed against."
                                                },
                                                "direction": {
                                                    "type": "string",
                                                    "enum": [
                                                        "incoming",
                                                        "outgoing"
                                                    ],
                                                    "description": "incoming = received, outgoing = sent."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Postal/recorded date, YYYY-MM-DD (no time of day)."
                                                },
                                                "subject": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "sender": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Feladó: the sender (free text)."
                                                },
                                                "to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Címzett: the addressee (free text)."
                                                },
                                                "recipient": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "For an incoming mail: the display name of the colleague who received it. For an outgoing mail: the free-text addressee/received-by."
                                                },
                                                "recipient_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Set only for an incoming mail whose recipient is a colleague (a user id); null for an outgoing mail."
                                                },
                                                "electronic": {
                                                    "type": "boolean",
                                                    "description": "True when the item was recorded as electronic (type_of_mail)."
                                                },
                                                "delivery_method_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Id of the delivery method (mail_delivery_methods)."
                                                },
                                                "delivery_method": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized delivery-method label (Posta, Cégkapu, Perkapu, ...), or the electronic/non-electronic fallback for a legacy row."
                                                },
                                                "tracking_no": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Azonosító: tracking number."
                                                },
                                                "folder_path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The colleague who recorded the entry."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to mail_register.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the entry through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters": {
            "get": {
                "operationId": "matters.list",
                "tags": [
                    "Matters"
                ],
                "summary": "List matters",
                "description": "Lists the matters (cases) the user may see, newest first. Use it to find a matter by case number, subject or client before referring to it elsewhere. Archived matters are hidden unless `include_archived` is true.",
                "x-scope": "matters:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 100,
                            "examples": [
                                "2026/0025"
                            ]
                        },
                        "description": "Free-text search in the subject and the client names (accents and case ignored) and the office's other case numbers; or a case number, either exactly as returned in case_number (the office numbering scheme) or as year/sequence such as \"2026/0025\".",
                        "example": "2026/0025"
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                512
                            ]
                        },
                        "description": "Only matters of this client.",
                        "example": 512
                    },
                    {
                        "name": "responsible_user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Only matters this user (ids from colleagues.list) is responsible for: as the main responsible, an additional responsible, or a member of a responsible workgroup (as the web colleague filter)."
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "examples": [
                                "2026-10-01T00:00:00+02:00"
                            ]
                        },
                        "description": "Only matters changed at or after this time (ISO 8601).",
                        "example": "2026-10-01T00:00:00+02:00"
                    },
                    {
                        "name": "include_archived",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "default": false
                        },
                        "description": "Include archived matters."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Matter id. Use it as `matter_id` elsewhere.",
                                                        "examples": [
                                                            1234
                                                        ]
                                                    },
                                                    "case_number": {
                                                        "type": "string",
                                                        "description": "Case number as displayed in Flowyer, in the office numbering scheme.",
                                                        "examples": [
                                                            "2026/0025"
                                                        ]
                                                    },
                                                    "subject": {
                                                        "type": "string",
                                                        "examples": [
                                                            "Kovács Kft. v. Nagy Bt. - contract dispute"
                                                        ]
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "active",
                                                            "archived"
                                                        ]
                                                    },
                                                    "case_type_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "case_type": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Localized name of the case type."
                                                    },
                                                    "responsible_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "responsible": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of the responsible lawyer."
                                                    },
                                                    "clients": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer"
                                                                },
                                                                "name": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "additionalProperties": false
                                                        },
                                                        "description": "Clients (principals) of the matter."
                                                    },
                                                    "started_on": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "restricted": {
                                                        "type": "boolean",
                                                        "description": "True when only the responsible lawyers may see the matter (Chinese wall)."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Present when an external agent created the record through this API."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "matters.create",
                "tags": [
                    "Matters"
                ],
                "summary": "Create matter",
                "description": "Opens a matter (case) with the next case number of the year. Needs at least one existing client (find or create it first). The responsible lawyer defaults to the key's user and is notified otherwise. Parties, contacts and fees are set in Flowyer.",
                "x-scope": "matters:create",
                "x-flowyer-module": "cases:create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subject": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 2,
                                        "pattern": "^[^<>]*$",
                                        "description": "Short title of the matter as it appears in lists. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Kovács Kft. v. Nagy Bt. - contract dispute"
                                        ]
                                    },
                                    "case_type_id": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Case type (area of law) id from the global Flowyer case-type list: pick the one whose name matches the user's words, or ask the user to choose by name. An unknown id answers 422 with details.known_case_types (id + localized name); an existing matter shows its type in matters.get `case_type_id` / `case_type`."
                                    },
                                    "client_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "minItems": 1,
                                        "maxItems": 20,
                                        "description": "Ids of the clients (principals). At least one, at most 20.",
                                        "examples": [
                                            [
                                                512
                                            ]
                                        ]
                                    },
                                    "responsible_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Responsible lawyer: a user id from colleagues.list (look a dictated name up there). Default: the user behind the key."
                                    },
                                    "started_on": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "Start date, YYYY-MM-DD. Default: today.",
                                        "examples": [
                                            "2026-10-29"
                                        ]
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 10000,
                                        "description": "Longer description, plain text."
                                    },
                                    "main_case_number": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 100,
                                        "description": "The office's own main reference number of the matter. Required when the office numbering scheme uses it (the API answers 422 otherwise)."
                                    },
                                    "restricted": {
                                        "type": "boolean",
                                        "description": "true = only the responsible lawyers may see the matter (Chinese wall).",
                                        "default": false
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "subject",
                                    "case_type_id",
                                    "client_ids"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Matter id. Use it as `matter_id` elsewhere.",
                                                    "examples": [
                                                        1234
                                                    ]
                                                },
                                                "case_number": {
                                                    "type": "string",
                                                    "description": "Case number as displayed in Flowyer, in the office numbering scheme.",
                                                    "examples": [
                                                        "2026/0025"
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft. v. Nagy Bt. - contract dispute"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "active",
                                                        "archived"
                                                    ]
                                                },
                                                "case_type_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "case_type": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized name of the case type."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the responsible lawyer."
                                                },
                                                "clients": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Clients (principals) of the matter."
                                                },
                                                "started_on": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "restricted": {
                                                    "type": "boolean",
                                                    "description": "True when only the responsible lawyers may see the matter (Chinese wall)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "litigious": {
                                                    "type": "boolean"
                                                },
                                                "archived_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the matter was archived, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Matter id. Use it as `matter_id` elsewhere.",
                                                    "examples": [
                                                        1234
                                                    ]
                                                },
                                                "case_number": {
                                                    "type": "string",
                                                    "description": "Case number as displayed in Flowyer, in the office numbering scheme.",
                                                    "examples": [
                                                        "2026/0025"
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft. v. Nagy Bt. - contract dispute"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "active",
                                                        "archived"
                                                    ]
                                                },
                                                "case_type_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "case_type": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized name of the case type."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the responsible lawyer."
                                                },
                                                "clients": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Clients (principals) of the matter."
                                                },
                                                "started_on": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "restricted": {
                                                    "type": "boolean",
                                                    "description": "True when only the responsible lawyers may see the matter (Chinese wall)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "litigious": {
                                                    "type": "boolean"
                                                },
                                                "archived_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the matter was archived, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/resolve": {
            "get": {
                "operationId": "matters.resolve",
                "tags": [
                    "Matters"
                ],
                "summary": "Resolve matter by name",
                "description": "Finds a matter by a spoken or misspelled subject or client name (accents, casing, small typos tolerated). Returns status exact/similar/none and candidates. Only \"exact\" is safe to use directly; else confirm with the user. Many lookalikes are never \"exact\": narrow with client_id or a fuller name.",
                "x-scope": "matters:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "name",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "maxLength": 255,
                            "minLength": 1,
                            "examples": [
                                "ingatlan adásvétel"
                            ]
                        },
                        "description": "Matter subject or client name to look up, as heard or dictated.",
                        "example": "ingatlan adásvétel"
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 1
                        },
                        "description": "Only matters of this client (use after clients.resolve returned an exact client)."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10,
                            "default": 5
                        },
                        "description": "Maximum candidates to return (default 5)."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "exact",
                                                        "similar",
                                                        "none"
                                                    ],
                                                    "description": "exact = one confident match (safe to use its id). similar = one or more approximate matches, confirm with the user first. none = no match, ask the user."
                                                },
                                                "matters": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer",
                                                                "description": "Matter id. Use it as `matter_id` elsewhere.",
                                                                "examples": [
                                                                    1234
                                                                ]
                                                            },
                                                            "case_number": {
                                                                "type": "string",
                                                                "description": "Case number as displayed in Flowyer, in the office numbering scheme.",
                                                                "examples": [
                                                                    "2026/0025"
                                                                ]
                                                            },
                                                            "subject": {
                                                                "type": "string",
                                                                "examples": [
                                                                    "Kovács Kft. v. Nagy Bt. - contract dispute"
                                                                ]
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "active",
                                                                    "archived"
                                                                ]
                                                            },
                                                            "case_type_id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "case_type": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "description": "Localized name of the case type."
                                                            },
                                                            "responsible_user_id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "responsible": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "description": "Display name of the responsible lawyer."
                                                            },
                                                            "clients": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer"
                                                                        },
                                                                        "name": {
                                                                            "type": "string"
                                                                        }
                                                                    },
                                                                    "additionalProperties": false
                                                                },
                                                                "description": "Clients (principals) of the matter."
                                                            },
                                                            "started_on": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date"
                                                            },
                                                            "restricted": {
                                                                "type": "boolean",
                                                                "description": "True when only the responsible lawyers may see the matter (Chinese wall)."
                                                            },
                                                            "created_at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            },
                                                            "updated_at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            },
                                                            "created_via_api": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "kind": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                            "key",
                                                                            "oauth"
                                                                        ],
                                                                        "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                                    },
                                                                    "key_id": {
                                                                        "type": "integer",
                                                                        "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                                    },
                                                                    "key_name": {
                                                                        "type": "string",
                                                                        "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                                    },
                                                                    "user_id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "user": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "at": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ],
                                                                        "format": "date-time"
                                                                    }
                                                                },
                                                                "additionalProperties": false,
                                                                "description": "Present when an external agent created the record through this API."
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Candidate matters, best match first."
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "How many matters matched before the list was cut to `limit`."
                                                },
                                                "truncated": {
                                                    "type": "boolean",
                                                    "description": "True when more matters matched than were returned, or too many lookalikes existed to check them all; narrow with client_id or a fuller name, or raise `limit`, rather than choosing from an incomplete list."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}": {
            "get": {
                "operationId": "matters.get",
                "tags": [
                    "Matters"
                ],
                "summary": "Get matter",
                "description": "Returns one matter (case) with its clients and details. Answers 404 when the matter does not exist or the user may not see it.",
                "x-scope": "matters:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id.",
                        "example": 1234
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Matter id. Use it as `matter_id` elsewhere.",
                                                    "examples": [
                                                        1234
                                                    ]
                                                },
                                                "case_number": {
                                                    "type": "string",
                                                    "description": "Case number as displayed in Flowyer, in the office numbering scheme.",
                                                    "examples": [
                                                        "2026/0025"
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft. v. Nagy Bt. - contract dispute"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "active",
                                                        "archived"
                                                    ]
                                                },
                                                "case_type_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "case_type": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized name of the case type."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the responsible lawyer."
                                                },
                                                "clients": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Clients (principals) of the matter."
                                                },
                                                "started_on": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "restricted": {
                                                    "type": "boolean",
                                                    "description": "True when only the responsible lawyers may see the matter (Chinese wall)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "litigious": {
                                                    "type": "boolean"
                                                },
                                                "archived_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the matter was archived, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "matters.update",
                "tags": [
                    "Matters"
                ],
                "summary": "Update matter",
                "description": "Changes a matter's subject, description, start date, litigious flag or responsible lawyer. Case number, Chinese wall, archive status, fees and client links are not editable here. Pass expected_updated_at from your last read; a conflicting change answers 409.",
                "x-scope": "matters:update",
                "x-flowyer-module": "cases:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "subject": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "Short title of the matter. Plain text, at most 255 characters as a NEW value; \"<\" and \">\" cannot be introduced either, but a stored subject that is longer or contains them may be sent back unchanged. null keeps the current subject."
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Longer description, plain text, at most 10000 characters as a NEW value; a longer stored description may be sent back unchanged."
                                    },
                                    "started_on": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "Start date, YYYY-MM-DD. null keeps the current value (a start date cannot be cleared)."
                                    },
                                    "litigious": {
                                        "type": "boolean",
                                        "description": "Whether the matter is litigious."
                                    },
                                    "responsible_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "description": "New responsible lawyer: an active colleague's user id from colleagues.list. They are notified when it is not you. Sending the current one - or null / 0, which a matter without a responsible reads back as - changes nothing."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Matter id. Use it as `matter_id` elsewhere.",
                                                    "examples": [
                                                        1234
                                                    ]
                                                },
                                                "case_number": {
                                                    "type": "string",
                                                    "description": "Case number as displayed in Flowyer, in the office numbering scheme.",
                                                    "examples": [
                                                        "2026/0025"
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Kovács Kft. v. Nagy Bt. - contract dispute"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "active",
                                                        "archived"
                                                    ]
                                                },
                                                "case_type_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "case_type": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Localized name of the case type."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the responsible lawyer."
                                                },
                                                "clients": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Clients (principals) of the matter."
                                                },
                                                "started_on": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "restricted": {
                                                    "type": "boolean",
                                                    "description": "True when only the responsible lawyers may see the matter (Chinese wall)."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "litigious": {
                                                    "type": "boolean"
                                                },
                                                "archived_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the matter was archived, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/comments": {
            "get": {
                "operationId": "comments.list",
                "tags": [
                    "Comments"
                ],
                "summary": "List matter comments",
                "description": "Lists the comments of a matter, oldest first: id, author, body (rich HTML) and the parent_id of a reply. Flat, not nested - rebuild the one-level threads from parent_id. Pass top_level_only to exclude replies. Answers 404 when the matter is not visible to the user.",
                "x-scope": "comments:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id (must be visible).",
                        "example": 1234
                    },
                    {
                        "name": "top_level_only",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "default": false
                        },
                        "description": "Only top-level comments (exclude replies). Default false."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            9876
                                                        ]
                                                    },
                                                    "matter_id": {
                                                        "type": "integer",
                                                        "description": "The matter (= case_id) the comment belongs to."
                                                    },
                                                    "parent_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "The top-level comment this replies to; null for a top-level comment. Replies are one level deep."
                                                    },
                                                    "author_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "User id of the author (null for a legacy import)."
                                                    },
                                                    "author_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of the author, or null."
                                                    },
                                                    "body": {
                                                        "type": "string",
                                                        "description": "The comment as stored: rich HTML, already HTMLPurifier-cleaned for comments written through this API."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "When the comment was posted, ISO 8601 in the office zone."
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Optimistic-lock token: pass it to comments.update as expected_updated_at. Not a display time; null for a legacy comment without one."
                                                    },
                                                    "edited": {
                                                        "type": "boolean",
                                                        "description": "True when the comment has been edited since it was posted."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "comments.create",
                "tags": [
                    "Comments"
                ],
                "summary": "Post matter comment",
                "description": "Posts a comment on a matter, or a one-level reply (parent_id = a TOP-LEVEL comment of the SAME matter). The body is rich HTML, server-side sanitised before store. Answers 404 when the matter is not visible, 422 when parent_id is not a top-level comment of the matter.",
                "x-scope": "comments:create",
                "x-flowyer-module": "cases:create",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id (must be visible).",
                        "example": 1234
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "body": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "The comment, rich HTML (as TinyMCE produces). Server-side HTMLPurifier-cleaned before store. At most 100000 characters.",
                                        "examples": [
                                            "<p>Egyetértek, a határidő tartható.</p>"
                                        ]
                                    },
                                    "parent_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Reply to this TOP-LEVEL comment of the SAME matter (from comments.list, parent_id = null); omit for a new top-level comment."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "body"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "matter_id": {
                                                    "type": "integer",
                                                    "description": "The matter (= case_id) the comment belongs to."
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The top-level comment this replies to; null for a top-level comment. Replies are one level deep."
                                                },
                                                "author_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the author (null for a legacy import)."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the author, or null."
                                                },
                                                "body": {
                                                    "type": "string",
                                                    "description": "The comment as stored: rich HTML, already HTMLPurifier-cleaned for comments written through this API."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the comment was posted, ISO 8601 in the office zone."
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Optimistic-lock token: pass it to comments.update as expected_updated_at. Not a display time; null for a legacy comment without one."
                                                },
                                                "edited": {
                                                    "type": "boolean",
                                                    "description": "True when the comment has been edited since it was posted."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "matter_id": {
                                                    "type": "integer",
                                                    "description": "The matter (= case_id) the comment belongs to."
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "The top-level comment this replies to; null for a top-level comment. Replies are one level deep."
                                                },
                                                "author_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User id of the author (null for a legacy import)."
                                                },
                                                "author_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the author, or null."
                                                },
                                                "body": {
                                                    "type": "string",
                                                    "description": "The comment as stored: rich HTML, already HTMLPurifier-cleaned for comments written through this API."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "When the comment was posted, ISO 8601 in the office zone."
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Optimistic-lock token: pass it to comments.update as expected_updated_at. Not a display time; null for a legacy comment without one."
                                                },
                                                "edited": {
                                                    "type": "boolean",
                                                    "description": "True when the comment has been edited since it was posted."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/documents": {
            "get": {
                "operationId": "documents.list",
                "tags": [
                    "Documents"
                ],
                "summary": "List matter documents",
                "description": "Lists the current versions of the documents filed under a matter: names, sizes, folders and who uploaded them. Metadata only; use documents.download (scope documents:download) for a signed link to the contents. Named documents come first, alphabetically, then imported ones that carry no name.",
                "x-scope": "documents:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id.",
                        "example": 1234
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 100,
                            "examples": [
                                "contract"
                            ]
                        },
                        "description": "Filter by file name.",
                        "example": "contract"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "description": "File name as shown in Flowyer: the name stored with the document, or its storage name when it was imported from an older system without one. documents.list is ordered by the stored name: documents that have one come first, alphabetically, then the imported ones without a stored name, oldest first (the order they were filed in Flowyer), which are therefore not sorted by the name shown here. The order is the same on every page, so limit and offset page through the list without repeats or gaps.",
                                                        "examples": [
                                                            "Contract_v2.docx"
                                                        ]
                                                    },
                                                    "size": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Bytes."
                                                    },
                                                    "version": {
                                                        "type": "integer",
                                                        "description": "Current version number of the file."
                                                    },
                                                    "folder": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "path": {
                                                                "type": "string",
                                                                "description": "Folder path inside the matter, \"/\" separated."
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The folder the document is filed in, or null at the matter root. documents.upload.complete answers null when the folder chosen at documents.upload.init was deleted while the bytes were uploading: the document is then filed at the matter root, which is where Flowyer shows it. If the root already holds a document of that name, the upload is filed under a suffixed name (\"Contract_2.pdf\") instead of becoming a new version of that unrelated document; the 201 echoes the stored `name`."
                                                    },
                                                    "folder_deleted": {
                                                        "type": "boolean",
                                                        "description": "True when the document is filed in a folder that no longer exists, which Flowyer's own file list does not show (`folder` is null for it, as it is for a document at the matter root). documents.upload.complete answers true only if the folder was deleted while the bytes were uploading AND moving the stored file to the matter root failed: the document is then kept in the deleted folder, where its contents are still reachable. False for everything else, a normal root filing included."
                                                    },
                                                    "created_by_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_by": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "documents.upload.complete",
                "tags": [
                    "Documents"
                ],
                "summary": "Finish document upload",
                "description": "Finishes a document upload: after the bytes were PUT to the upload_url, records the file on the matter as a new version. Pass the upload_token from documents.upload.init. The file metadata is taken from the token, not from this request. A folder deleted meanwhile files the document at the root.",
                "x-scope": "documents:create",
                "x-flowyer-module": "cases:create",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Matter the document belongs to (same as in init)."
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "upload_token": {
                                        "type": "string",
                                        "maxLength": 4096,
                                        "minLength": 1,
                                        "description": "The token returned by documents.upload.init."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "upload_token"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created. Also the answer when this upload_token was already completed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "File name as shown in Flowyer: the name stored with the document, or its storage name when it was imported from an older system without one. documents.list is ordered by the stored name: documents that have one come first, alphabetically, then the imported ones without a stored name, oldest first (the order they were filed in Flowyer), which are therefore not sorted by the name shown here. The order is the same on every page, so limit and offset page through the list without repeats or gaps.",
                                                    "examples": [
                                                        "Contract_v2.docx"
                                                    ]
                                                },
                                                "size": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Bytes."
                                                },
                                                "version": {
                                                    "type": "integer",
                                                    "description": "Current version number of the file."
                                                },
                                                "folder": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "path": {
                                                            "type": "string",
                                                            "description": "Folder path inside the matter, \"/\" separated."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The folder the document is filed in, or null at the matter root. documents.upload.complete answers null when the folder chosen at documents.upload.init was deleted while the bytes were uploading: the document is then filed at the matter root, which is where Flowyer shows it. If the root already holds a document of that name, the upload is filed under a suffixed name (\"Contract_2.pdf\") instead of becoming a new version of that unrelated document; the 201 echoes the stored `name`."
                                                },
                                                "folder_deleted": {
                                                    "type": "boolean",
                                                    "description": "True when the document is filed in a folder that no longer exists, which Flowyer's own file list does not show (`folder` is null for it, as it is for a document at the matter root). documents.upload.complete answers true only if the folder was deleted while the bytes were uploading AND moving the stored file to the matter root failed: the document is then kept in the deleted folder, where its contents are still reachable. False for everything else, a normal root filing included."
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "File name as shown in Flowyer: the name stored with the document, or its storage name when it was imported from an older system without one. documents.list is ordered by the stored name: documents that have one come first, alphabetically, then the imported ones without a stored name, oldest first (the order they were filed in Flowyer), which are therefore not sorted by the name shown here. The order is the same on every page, so limit and offset page through the list without repeats or gaps.",
                                                    "examples": [
                                                        "Contract_v2.docx"
                                                    ]
                                                },
                                                "size": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Bytes."
                                                },
                                                "version": {
                                                    "type": "integer",
                                                    "description": "Current version number of the file."
                                                },
                                                "folder": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "path": {
                                                            "type": "string",
                                                            "description": "Folder path inside the matter, \"/\" separated."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The folder the document is filed in, or null at the matter root. documents.upload.complete answers null when the folder chosen at documents.upload.init was deleted while the bytes were uploading: the document is then filed at the matter root, which is where Flowyer shows it. If the root already holds a document of that name, the upload is filed under a suffixed name (\"Contract_2.pdf\") instead of becoming a new version of that unrelated document; the 201 echoes the stored `name`."
                                                },
                                                "folder_deleted": {
                                                    "type": "boolean",
                                                    "description": "True when the document is filed in a folder that no longer exists, which Flowyer's own file list does not show (`folder` is null for it, as it is for a document at the matter root). documents.upload.complete answers true only if the folder was deleted while the bytes were uploading AND moving the stored file to the matter root failed: the document is then kept in the deleted folder, where its contents are still reachable. False for everything else, a normal root filing included."
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `upload_not_finished`: the file has not reached storage yet; finish the PUT to `upload_url`, then call complete again. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`), or the file exceeds the upload limit (`file_too_large`; `details.max` gives the limit in bytes).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/documents/uploads": {
            "post": {
                "operationId": "documents.upload.init",
                "tags": [
                    "Documents"
                ],
                "summary": "Start document upload",
                "description": "Starts a document upload: returns a signed upload_url and an upload_token. PUT the bytes there, then call documents.upload.complete. The PUT is a plain HTTPS request outside this API and outside MCP tools: an assistant without its own HTTP client should ask the user to upload the file in Flowyer.",
                "x-scope": "documents:create",
                "x-flowyer-module": "cases:create",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Matter the document belongs to (must be visible)."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "filename": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "File name with extension, e.g. \"Contract.pdf\". Plain text; \"<\" and \">\" are not allowed. Executable and web file types are refused (422 blocked_file_type).",
                                        "examples": [
                                            "Contract.pdf"
                                        ]
                                    },
                                    "content_type": {
                                        "type": "string",
                                        "maxLength": 100,
                                        "minLength": 1,
                                        "description": "MIME type sent on the PUT, e.g. \"application/pdf\". It is part of the signature and must match exactly.",
                                        "examples": [
                                            "application/pdf"
                                        ]
                                    },
                                    "size": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "File size in bytes, at most 104857600 (the upload limit); a larger size answers 413 `file_too_large`.",
                                        "examples": [
                                            248000
                                        ]
                                    },
                                    "folder_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Folder inside the matter: a folder id from documents.folders (it lists empty folders too). Omit for the matter root."
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "filename",
                                    "content_type",
                                    "size"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "upload_url": {
                                                    "type": "string",
                                                    "description": "Signed URL. PUT the file bytes here with the given content type AND the if_generation_match header below: a plain HTTPS request made by your own HTTP client (no API or MCP tool sends it)."
                                                },
                                                "upload_token": {
                                                    "type": "string",
                                                    "description": "Pass this to documents.upload.complete after the PUT succeeds."
                                                },
                                                "content_type": {
                                                    "type": "string",
                                                    "description": "Send exactly this Content-Type on the PUT."
                                                },
                                                "if_generation_match": {
                                                    "type": "string",
                                                    "description": "Send this value as the \"x-goog-if-generation-match\" header on the PUT (always \"0\"). It makes the upload single-use: the PUT is accepted only while the object does not yet exist, so the signed URL cannot overwrite an already-filed document."
                                                },
                                                "object_key": {
                                                    "type": "string",
                                                    "description": "Internal storage name (for reference)."
                                                },
                                                "expires_in": {
                                                    "type": "integer",
                                                    "description": "Seconds until the upload URL and token expire."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`), or the file exceeds the upload limit (`file_too_large`; `details.max` gives the limit in bytes).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/emails": {
            "get": {
                "operationId": "emails.list",
                "tags": [
                    "Emails"
                ],
                "summary": "List matter emails",
                "description": "Lists the emails saved onto a matter: sender name and address, subject, size and the colleague who saved each one, newest sent first. Header and metadata only, never the body or the raw HTML. Use emails.get for a single message's plain-text body.",
                "x-scope": "emails:read",
                "x-flowyer-module": "emails:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id.",
                        "example": 1234
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 100,
                            "examples": [
                                "invoice"
                            ]
                        },
                        "description": "Filter by subject, sender name or sender address (accent- and case-insensitive). Not the body.",
                        "example": "invoice"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Email id (use with emails.get).",
                                                        "examples": [
                                                            1234
                                                        ]
                                                    },
                                                    "from_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of the outside party. The store keeps no direction or recipient columns, so this is always the external party, never a colleague, and the API cannot say whether the mail was incoming or outgoing."
                                                    },
                                                    "from_address": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "SMTP address of the outside party."
                                                    },
                                                    "subject": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "sent_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "When the message was sent. The stored value's timezone is inconsistent by ingest path (the IMAP worker stores UTC, the Outlook add-in stores an office-zone wall time), so it is best-effort and the list order by it can be off by the office UTC offset across sources. created_at is the reliable timestamp."
                                                    },
                                                    "size": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Bytes of the stored .eml/.msg file."
                                                    },
                                                    "extension": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "\"msg\" (Outlook add-in) or \"eml\" (IMAP / default); null on some legacy rows."
                                                    },
                                                    "saved_by_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "User id of the colleague who saved the mail into Flowyer."
                                                    },
                                                    "saved_by": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of that colleague."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "When the mail was saved into Flowyer (office-zone wall time). The reliable timestamp for stable pagination."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/folders": {
            "get": {
                "operationId": "documents.folders",
                "tags": [
                    "Documents"
                ],
                "summary": "List matter folders",
                "description": "Lists every folder of a matter, empty ones included: id, name, parent_id and the \"/\"-separated path, ordered by path. Pass a folder id as folder_id to documents.upload.init. Answers 404 when the matter is not visible to the user.",
                "x-scope": "documents:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id.",
                        "example": 1234
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 100,
                            "examples": [
                                "Beadványok"
                            ]
                        },
                        "description": "Only folders whose path contains this text (case and accents ignored), e.g. a folder name.",
                        "example": "Beadványok"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Folder id: pass it as folder_id to documents.upload.init."
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "description": "Folder name as shown in Flowyer."
                                                    },
                                                    "parent_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Id of the parent folder; null for a folder at the matter root."
                                                    },
                                                    "path": {
                                                        "type": "string",
                                                        "description": "Folder path inside the matter, \"/\" separated, e.g. \"/Iratok/Beadványok\" (the same path documents.list shows for a file's folder)."
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Pass this to documents.folders.rename as expected_updated_at."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "documents.folders.create",
                "tags": [
                    "Documents"
                ],
                "summary": "Create matter folder",
                "description": "Creates a folder in a matter, at the root or under parent_id (a folder of the SAME matter). The name is plain text (\"<\" and \">\" are not allowed). File a document into it by passing the returned id as folder_id to documents.upload.init. Answers 404 when the matter is not visible.",
                "x-scope": "documents:create",
                "x-flowyer-module": "cases:create",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter the folder belongs to (must be visible).",
                        "example": 1234
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "Folder name, at most 255 characters. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Beadványok"
                                        ]
                                    },
                                    "parent_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Parent folder id (from documents.folders) inside the SAME matter; omit for a folder at the matter root."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Folder id: pass it as folder_id to documents.upload.init, or as parent_id to documents.folders.create."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Folder name as shown in Flowyer."
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Id of the parent folder; null for a folder at the matter root."
                                                },
                                                "path": {
                                                    "type": "string",
                                                    "description": "Folder path inside the matter, \"/\" separated, e.g. \"/Iratok/Beadványok\"."
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to documents.folders.rename as expected_updated_at."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Folder id: pass it as folder_id to documents.upload.init, or as parent_id to documents.folders.create."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "description": "Folder name as shown in Flowyer."
                                                },
                                                "parent_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Id of the parent folder; null for a folder at the matter root."
                                                },
                                                "path": {
                                                    "type": "string",
                                                    "description": "Folder path inside the matter, \"/\" separated, e.g. \"/Iratok/Beadványok\"."
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to documents.folders.rename as expected_updated_at."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/litigation": {
            "get": {
                "operationId": "litigation.list",
                "tags": [
                    "Litigation"
                ],
                "summary": "List matter litigation history",
                "description": "Lists the litigation-history entries (pertörténet) of a matter, newest event first: a dated note with a title, an HTML description and a location. Answers 404 when the matter is not visible to the user.",
                "x-scope": "litigation:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id.",
                        "example": 1234
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            4521
                                                        ]
                                                    },
                                                    "title": {
                                                        "type": "string",
                                                        "description": "Entry title. Plain text.",
                                                        "examples": [
                                                            "Első tárgyalás elhalasztva"
                                                        ]
                                                    },
                                                    "description": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Entry details as rich HTML, sanitised server-side."
                                                    },
                                                    "location": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Where it happened (plain text), e.g. a court room; nullable."
                                                    },
                                                    "event_date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date",
                                                        "description": "Day of the entry, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                    },
                                                    "user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Author (the user who created the entry)."
                                                    },
                                                    "created_by": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of the author."
                                                    },
                                                    "last_editor_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "User who last edited the entry."
                                                    },
                                                    "last_editor": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of the last editor."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Pass this to litigation.update as expected_updated_at."
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Present when an external agent created the entry through this API."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "litigation.create",
                "tags": [
                    "Litigation"
                ],
                "summary": "Create litigation history entry",
                "description": "Adds a litigation-history entry (pertörténet) to a matter: a title (plain text, \"<\"/\">\" not allowed), an optional HTML description (sanitised server-side), an optional location and an event date (defaults to today). Answers 404 when the matter is not visible.",
                "x-scope": "litigation:create",
                "x-flowyer-module": "cases:create",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter the entry belongs to (must be visible).",
                        "example": 1234
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "maxLength": 2000,
                                        "minLength": 1,
                                        "pattern": "^[^<>]*$",
                                        "description": "Entry title, at most 2000 characters. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Első tárgyalás elhalasztva"
                                        ]
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Entry details. Rich HTML, sanitised server-side with the knowledge-base profile."
                                    },
                                    "location": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "Where it happened (plain text, at most 255 characters); \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Fővárosi Törvényszék, 215. tárgyaló"
                                        ]
                                    },
                                    "event_date": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "Day of the entry, YYYY-MM-DD. Defaults to today (office time zone).",
                                        "examples": [
                                            "2026-11-15"
                                        ]
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "title"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4521
                                                    ]
                                                },
                                                "title": {
                                                    "type": "string",
                                                    "description": "Entry title. Plain text.",
                                                    "examples": [
                                                        "Első tárgyalás elhalasztva"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Entry details as rich HTML, sanitised server-side."
                                                },
                                                "location": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Where it happened (plain text), e.g. a court room; nullable."
                                                },
                                                "event_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day of the entry, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Author (the user who created the entry)."
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the author."
                                                },
                                                "last_editor_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User who last edited the entry."
                                                },
                                                "last_editor": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the last editor."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to litigation.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the entry through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4521
                                                    ]
                                                },
                                                "title": {
                                                    "type": "string",
                                                    "description": "Entry title. Plain text.",
                                                    "examples": [
                                                        "Első tárgyalás elhalasztva"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Entry details as rich HTML, sanitised server-side."
                                                },
                                                "location": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Where it happened (plain text), e.g. a court room; nullable."
                                                },
                                                "event_date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day of the entry, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Author (the user who created the entry)."
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the author."
                                                },
                                                "last_editor_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "User who last edited the entry."
                                                },
                                                "last_editor": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the last editor."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to litigation.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the entry through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/responsibles": {
            "get": {
                "operationId": "matters.responsibles",
                "tags": [
                    "Matters"
                ],
                "summary": "List matter responsibles",
                "description": "Lists the ADDITIONAL responsibles of a matter (the primary responsible is on matters.get): each is a colleague (type \"user\", user_id set) or a workgroup (type \"workgroup\", workgroup_id set), all of whom can see the matter. Answers 404 when the matter is not visible.",
                "x-scope": "matters:read",
                "x-flowyer-module": "cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id.",
                        "example": 1234
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "type": {
                                                        "type": "string",
                                                        "enum": [
                                                            "user",
                                                            "workgroup"
                                                        ],
                                                        "description": "\"user\" = a single colleague; \"workgroup\" = every member of a workgroup."
                                                    },
                                                    "user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Colleague user id for a \"user\" entry (pass it as user_id to matters.responsibles.add); null for a workgroup."
                                                    },
                                                    "workgroup_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Workgroup id for a \"workgroup\" entry; null for a single colleague. Workgroup responsibles are managed in Flowyer."
                                                    },
                                                    "name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Display name of the colleague or workgroup."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "matters.responsibles.add",
                "tags": [
                    "Matters"
                ],
                "summary": "Add matter responsible",
                "description": "Adds a colleague (user_id from colleagues.list) as an additional responsible of a matter. This GIVES that colleague access to the matter, so only add someone who should see it; they are notified. Idempotent: re-adding an existing responsible makes no change.",
                "x-scope": "matters:update",
                "x-flowyer-module": "cases:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter the colleague becomes responsible for (must be visible).",
                        "example": 1234
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "user_id": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Colleague to add: a user id from colleagues.list. Adding them gives them access to the matter.",
                                        "examples": [
                                            42
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "user_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "user_id": {
                                                    "type": "integer",
                                                    "description": "The colleague now responsible for the matter."
                                                },
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Display name of the colleague."
                                                },
                                                "already_responsible": {
                                                    "type": "boolean",
                                                    "description": "True when the colleague was already a responsible of the matter (nothing changed)."
                                                },
                                                "notified": {
                                                    "type": "boolean",
                                                    "description": "True when the colleague was notified they were added. Never true when the colleague is you, or when they were already responsible."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/matters/{id}/trials": {
            "get": {
                "operationId": "trials.list",
                "tags": [
                    "Trials"
                ],
                "summary": "List matter hearings",
                "description": "Lists the court hearings (tárgyalások) of a matter: date, court, place, the attending colleagues and the judge, newest first. Optionally filtered by a from/to day range or by updated_since. Answers 404 when the matter is not visible to the user.",
                "x-scope": "trials:read",
                "x-flowyer-module": "trials:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter id.",
                        "example": 1234
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-01-01"
                            ]
                        },
                        "description": "Only hearings on or after this day (YYYY-MM-DD), in the office time zone.",
                        "example": "2026-01-01"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-12-31"
                            ]
                        },
                        "description": "Only hearings on or before this day (YYYY-MM-DD), in the office time zone.",
                        "example": "2026-12-31"
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        },
                        "description": "Only hearings changed at or after this ISO 8601 time."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            4321
                                                        ]
                                                    },
                                                    "matter": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "case_number": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The matter (case) the hearing belongs to."
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Hearing date and time, ISO 8601 in the office time zone. It is stored in UTC, so compare instants rather than the wall-clock text.",
                                                        "examples": [
                                                            "2026-03-02T09:00:00+01:00"
                                                        ]
                                                    },
                                                    "participation": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "enum": [
                                                            "required",
                                                            "not_required",
                                                            null
                                                        ],
                                                        "description": "Whether a colleague's attendance is required: \"required\", \"not_required\", or null when unset."
                                                    },
                                                    "court": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "city": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "zip": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "address": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "source": {
                                                                "type": "string",
                                                                "description": "Always \"registry\": the court is a reference to the shared court registry (courts.list), not free text."
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The court of the hearing, resolved from the shared court registry; null when no court is set."
                                                    },
                                                    "place": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Room or location of the hearing. Plain text."
                                                    },
                                                    "name_of_the_judge": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Name of the judge. Plain text."
                                                    },
                                                    "notes": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Free-text notes on the hearing. Plain text."
                                                    },
                                                    "responsibles": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "user_id": {
                                                                    "type": "integer"
                                                                },
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "additionalProperties": false
                                                        },
                                                        "description": "Colleagues attending the hearing (ids from colleagues.list)."
                                                    },
                                                    "recorded_by": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The colleague who recorded the hearing."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Pass this to trials.update as expected_updated_at."
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Present when an external agent created the record through this API."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "trials.create",
                "tags": [
                    "Trials"
                ],
                "summary": "Create hearing",
                "description": "Records a court hearing (tárgyalás) on a matter: time, an optional court (court_id from courts.list), the room, judge, notes and attending colleagues. The matter must be visible and not archived; attendees are notified. A time with no offset is read in the office zone.",
                "x-scope": "trials:create",
                "x-flowyer-module": "trials:create",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Matter the hearing belongs to (must be visible and not archived).",
                        "example": 1234
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "date": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "Hearing date and time, ISO 8601. With an offset it is honoured; without one it is read in the office time zone. Stored in UTC.",
                                        "examples": [
                                            "2026-03-02T09:00:00+01:00"
                                        ]
                                    },
                                    "court_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Court of the hearing: an id from courts.list (the shared court registry). Omit when the court is not known.",
                                        "examples": [
                                            42
                                        ]
                                    },
                                    "participation": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "required",
                                            "not_required",
                                            null
                                        ],
                                        "description": "Whether a colleague's attendance is required. Omit to leave it unset."
                                    },
                                    "place": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Room or location of the hearing. Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "II. emelet 205."
                                        ]
                                    },
                                    "name_of_the_judge": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "Name of the judge. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "notes": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 10000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Free-text notes on the hearing. Plain text; \"<\" and \">\" are not allowed."
                                    },
                                    "responsible_user_ids": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Colleague user ids (from colleagues.list) attending the hearing."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "date"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter (case) the hearing belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Hearing date and time, ISO 8601 in the office time zone. It is stored in UTC, so compare instants rather than the wall-clock text.",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "participation": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "required",
                                                        "not_required",
                                                        null
                                                    ],
                                                    "description": "Whether a colleague's attendance is required: \"required\", \"not_required\", or null when unset."
                                                },
                                                "court": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "address": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "source": {
                                                            "type": "string",
                                                            "description": "Always \"registry\": the court is a reference to the shared court registry (courts.list), not free text."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The court of the hearing, resolved from the shared court registry; null when no court is set."
                                                },
                                                "place": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Room or location of the hearing. Plain text."
                                                },
                                                "name_of_the_judge": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Name of the judge. Plain text."
                                                },
                                                "notes": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Free-text notes on the hearing. Plain text."
                                                },
                                                "responsibles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Colleagues attending the hearing (ids from colleagues.list)."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who recorded the hearing."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to trials.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter (case) the hearing belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Hearing date and time, ISO 8601 in the office time zone. It is stored in UTC, so compare instants rather than the wall-clock text.",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "participation": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "required",
                                                        "not_required",
                                                        null
                                                    ],
                                                    "description": "Whether a colleague's attendance is required: \"required\", \"not_required\", or null when unset."
                                                },
                                                "court": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "address": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "source": {
                                                            "type": "string",
                                                            "description": "Always \"registry\": the court is a reference to the shared court registry (courts.list), not free text."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The court of the hearing, resolved from the shared court registry; null when no court is set."
                                                },
                                                "place": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Room or location of the hearing. Plain text."
                                                },
                                                "name_of_the_judge": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Name of the judge. Plain text."
                                                },
                                                "notes": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Free-text notes on the hearing. Plain text."
                                                },
                                                "responsibles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Colleagues attending the hearing (ids from colleagues.list)."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who recorded the hearing."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to trials.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me": {
            "get": {
                "operationId": "me",
                "tags": [
                    "Me"
                ],
                "summary": "Who am I",
                "description": "Returns the user and office this API key acts for, the key's scopes (what it may do) and the rate limits. Call it first to learn which operations are available; needs no scope.",
                "x-scope": null,
                "x-flowyer-module": null,
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "user": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "language": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "office": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "timezone": {
                                                            "type": "string",
                                                            "description": "IANA zone the API reads and writes timestamps in, e.g. Europe/Budapest."
                                                        },
                                                        "currency_id": {
                                                            "type": "integer",
                                                            "description": "The office currency (Flowyer currency id): costs.create books in it when currency_id is omitted."
                                                        },
                                                        "currency": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "ISO code of the office currency, e.g. HUF, EUR, RON."
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "key": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string",
                                                            "description": "Name the user gave this key, or the connected app for an OAuth token."
                                                        },
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\" = a static API key, \"oauth\" = an OAuth 2.1 access token."
                                                        },
                                                        "prefix": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "First characters of a static key, for identification only; null for OAuth."
                                                        },
                                                        "expires_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        },
                                                        "last_used_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "scopes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Scopes of this credential, e.g. \"matters:read\". An operation whose scope is missing answers 403."
                                                },
                                                "available_scopes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "All scopes the key owner could enable in Flowyer."
                                                },
                                                "limits": {
                                                    "type": "object",
                                                    "properties": {
                                                        "requests_per_minute": {
                                                            "type": "integer"
                                                        },
                                                        "list_max_limit": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "channel": {
                                                    "type": "string",
                                                    "enum": [
                                                        "rest",
                                                        "mcp"
                                                    ],
                                                    "description": "How the request reached Flowyer."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unknown query parameter (this operation takes none); `details.fields` names it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/portals": {
            "get": {
                "operationId": "portal.threads.list",
                "tags": [
                    "Portal"
                ],
                "summary": "List client portals",
                "description": "Lists the client portals (threads) the user may access: the matter, the client-side participants, the message and participant counts and the last message time, newest first. Optionally filtered to one matter (matter_id). A matter has at most one portal.",
                "x-scope": "portal:read",
                "x-flowyer-module": "client-portal:read, cases:read",
                "parameters": [
                    {
                        "name": "matter_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Only the portal of this matter (404 matter_not_visible when the matter is not visible). A matter has at most one portal.",
                        "example": 1234
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Portal (thread) id - the handle for portal.messages.list and portal.reply.",
                                                        "examples": [
                                                            57
                                                        ]
                                                    },
                                                    "matter": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "case_number": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The matter (case) the portal belongs to."
                                                    },
                                                    "client_participants": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "kind": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "client",
                                                                        "contact",
                                                                        "email"
                                                                    ],
                                                                    "description": "client = a principal, contact = a client contact, email = a legacy e-mail-only grant."
                                                                }
                                                            },
                                                            "additionalProperties": false
                                                        },
                                                        "description": "The external client-side participants the firm is talking to."
                                                    },
                                                    "participant_count": {
                                                        "type": "integer",
                                                        "description": "Number of live participants (staff and client)."
                                                    },
                                                    "message_count": {
                                                        "type": "integer",
                                                        "description": "Number of non-deleted messages in the thread."
                                                    },
                                                    "last_message_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "When the newest non-deleted message was posted, ISO 8601 in the office zone; null for an empty thread."
                                                    },
                                                    "unread_for_me": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Unread messages for the acting user's own participant row; null when the acting user is not a participant of this portal."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/portals/{id}/messages": {
            "get": {
                "operationId": "portal.messages.list",
                "tags": [
                    "Portal"
                ],
                "summary": "List portal messages",
                "description": "Lists the messages of a client portal thread, oldest first, with the author (staff or client), the plain-text body and any attachment metadata. Answers 404 when the portal does not exist or is not accessible. Does not mark messages as read.",
                "x-scope": "portal:read",
                "x-flowyer-module": "client-portal:read, cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                57
                            ]
                        },
                        "description": "Portal id (must be accessible).",
                        "example": 57
                    },
                    {
                        "name": "include_deleted",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "default": false
                        },
                        "description": "Include deleted messages (their body is blanked). Default false."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "portal_messages.id.",
                                                        "examples": [
                                                            8012
                                                        ]
                                                    },
                                                    "author": {
                                                        "type": "object",
                                                        "properties": {
                                                            "participant_id": {
                                                                "type": [
                                                                    "integer",
                                                                    "null"
                                                                ]
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "staff",
                                                                    "client"
                                                                ],
                                                                "description": "staff = a colleague of the firm, client = the external client."
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Who wrote the message."
                                                    },
                                                    "direction": {
                                                        "type": "string",
                                                        "enum": [
                                                            "from_firm",
                                                            "from_client"
                                                        ],
                                                        "description": "from_firm = a staff author, from_client = the external client."
                                                    },
                                                    "body": {
                                                        "type": "string",
                                                        "description": "The message as plain text (<br> decoded to line breaks). Empty string for a deleted message."
                                                    },
                                                    "attachment": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "portal_document_id": {
                                                                "type": "integer"
                                                            },
                                                            "file_name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Attachment metadata when the message has a document; downloading it is out of scope. Null when there is none."
                                                    },
                                                    "is_deleted": {
                                                        "type": "boolean"
                                                    },
                                                    "deleted_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "When the message was posted, ISO 8601 in the office zone."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "portal.reply",
                "tags": [
                    "Portal"
                ],
                "summary": "Reply in client portal",
                "description": "Posts a staff reply in a client portal thread. The client sees it in the portal and is notified by e-mail (a signed magic-link notice, not the text); colleagues get an in-app notice. Plain text, escaped on store. 404 when the portal is not accessible.",
                "x-scope": "portal:reply",
                "x-flowyer-module": "client-portal:read, cases:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                57
                            ]
                        },
                        "description": "Portal id to reply in (must be accessible).",
                        "example": 57
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "body": {
                                        "type": "string",
                                        "maxLength": 20000,
                                        "minLength": 1,
                                        "description": "The reply, plain text. Angle brackets are accepted and escaped on store. At most 20000 characters.",
                                        "examples": [
                                            "Tisztelt Ügyfelünk! A beadványt ma benyújtottuk."
                                        ]
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "body"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "message": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "examples": [
                                                                8012
                                                            ]
                                                        },
                                                        "author": {
                                                            "type": "object",
                                                            "properties": {
                                                                "participant_id": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "kind": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "staff",
                                                                        "client"
                                                                    ],
                                                                    "description": "staff = a colleague of the firm, client = the external client."
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "The acting staff user who posted the reply."
                                                        },
                                                        "direction": {
                                                            "type": "string",
                                                            "enum": [
                                                                "from_firm",
                                                                "from_client"
                                                            ],
                                                            "description": "Always \"from_firm\" for a reply posted through this API."
                                                        },
                                                        "body": {
                                                            "type": "string",
                                                            "description": "The posted message as plain text."
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        },
                                                        "portal": {
                                                            "type": "object",
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer"
                                                                },
                                                                "matter": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer"
                                                                        },
                                                                        "case_number": {
                                                                            "type": "string"
                                                                        }
                                                                    },
                                                                    "additionalProperties": false
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "The portal (thread) and its matter the reply was posted in."
                                                        },
                                                        "created_via_api": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "kind": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "key",
                                                                        "oauth"
                                                                    ],
                                                                    "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                                },
                                                                "key_id": {
                                                                    "type": "integer",
                                                                    "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                                },
                                                                "key_name": {
                                                                    "type": "string",
                                                                    "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                                },
                                                                "user_id": {
                                                                    "type": "integer"
                                                                },
                                                                "user": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "at": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ],
                                                                    "format": "date-time"
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "Provenance of the message created through this API."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The posted reply."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "message": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "examples": [
                                                                8012
                                                            ]
                                                        },
                                                        "author": {
                                                            "type": "object",
                                                            "properties": {
                                                                "participant_id": {
                                                                    "type": [
                                                                        "integer",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "name": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "kind": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "staff",
                                                                        "client"
                                                                    ],
                                                                    "description": "staff = a colleague of the firm, client = the external client."
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "The acting staff user who posted the reply."
                                                        },
                                                        "direction": {
                                                            "type": "string",
                                                            "enum": [
                                                                "from_firm",
                                                                "from_client"
                                                            ],
                                                            "description": "Always \"from_firm\" for a reply posted through this API."
                                                        },
                                                        "body": {
                                                            "type": "string",
                                                            "description": "The posted message as plain text."
                                                        },
                                                        "created_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        },
                                                        "portal": {
                                                            "type": "object",
                                                            "properties": {
                                                                "id": {
                                                                    "type": "integer"
                                                                },
                                                                "matter": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "id": {
                                                                            "type": "integer"
                                                                        },
                                                                        "case_number": {
                                                                            "type": "string"
                                                                        }
                                                                    },
                                                                    "additionalProperties": false
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "The portal (thread) and its matter the reply was posted in."
                                                        },
                                                        "created_via_api": {
                                                            "type": [
                                                                "object",
                                                                "null"
                                                            ],
                                                            "properties": {
                                                                "kind": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "key",
                                                                        "oauth"
                                                                    ],
                                                                    "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                                },
                                                                "key_id": {
                                                                    "type": "integer",
                                                                    "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                                },
                                                                "key_name": {
                                                                    "type": "string",
                                                                    "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                                },
                                                                "user_id": {
                                                                    "type": "integer"
                                                                },
                                                                "user": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "at": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ],
                                                                    "format": "date-time"
                                                                }
                                                            },
                                                            "additionalProperties": false,
                                                            "description": "Provenance of the message created through this API."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The posted reply."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tasks": {
            "get": {
                "operationId": "tasks.list",
                "tags": [
                    "Tasks"
                ],
                "summary": "List tasks",
                "description": "Lists tasks (to-dos with a deadline) the user may see, soonest deadline first. Open tasks by default; filter by assignee, matter, client or deadline range.",
                "x-scope": "tasks:read",
                "x-flowyer-module": "tasks:read",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "closed",
                                "all"
                            ],
                            "default": "open"
                        },
                        "description": "open (default), closed or all."
                    },
                    {
                        "name": "assigned_to_user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Only tasks assigned to this user (a user id from colleagues.list)."
                    },
                    {
                        "name": "matter_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Only tasks of this matter."
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Only caseless tasks of this client."
                    },
                    {
                        "name": "deadline_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-11-01"
                            ]
                        },
                        "description": "Deadline on or after this date.",
                        "example": "2026-11-01"
                    },
                    {
                        "name": "deadline_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date",
                            "examples": [
                                "2026-11-30"
                            ]
                        },
                        "description": "Deadline on or before this date.",
                        "example": "2026-11-30"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "examples": [
                                                            9876
                                                        ]
                                                    },
                                                    "subject": {
                                                        "type": "string",
                                                        "examples": [
                                                            "Submit the statement of defence"
                                                        ]
                                                    },
                                                    "description": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "deadline": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date",
                                                        "description": "Due date, YYYY-MM-DD.",
                                                        "examples": [
                                                            "2026-11-15"
                                                        ]
                                                    },
                                                    "priority": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "1 = low, 2 = medium, 3 = high; null = not set (an older task without a priority).",
                                                        "examples": [
                                                            2
                                                        ]
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "open",
                                                            "closed"
                                                        ]
                                                    },
                                                    "closed_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date",
                                                        "description": "Day the task was closed, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                    },
                                                    "matter": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "case_number": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The matter the task belongs to, if any."
                                                    },
                                                    "client": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The client: the matter's first client, or the task's own client when it has no matter."
                                                    },
                                                    "assigned_to_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "assigned_to": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_by_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_by": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "flag_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "tasks.create",
                "tags": [
                    "Tasks"
                ],
                "summary": "Create task",
                "description": "Creates a task (to-do with a deadline), either on a matter (`matter_id`, visible and not archived) or caseless, optionally for a client (`client_id`). The assignee defaults to the key's user and is notified when it is someone else.",
                "x-scope": "tasks:create",
                "x-flowyer-module": "tasks:create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "subject": {
                                        "type": "string",
                                        "maxLength": 1000,
                                        "minLength": 2,
                                        "description": "What has to be done. Plain text.",
                                        "examples": [
                                            "Submit the statement of defence"
                                        ]
                                    },
                                    "deadline": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Due date, YYYY-MM-DD.",
                                        "examples": [
                                            "2026-11-15"
                                        ]
                                    },
                                    "matter_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Matter the task belongs to. Omit for a caseless task.",
                                        "examples": [
                                            1234
                                        ]
                                    },
                                    "client_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Client of a caseless task. Not allowed together with matter_id (a matter's task takes the matter's client)."
                                    },
                                    "assigned_to_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Colleague responsible for the task: a user id from colleagues.list (look a dictated name up there). Default: the user behind the key."
                                    },
                                    "priority": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 3,
                                        "description": "1 = low, 2 = medium (default), 3 = high.",
                                        "default": 2
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 10000,
                                        "description": "Longer details, plain text."
                                    },
                                    "flag_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Id of an office task flag (label)."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "subject",
                                    "deadline"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Submit the statement of defence"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "deadline": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Due date, YYYY-MM-DD.",
                                                    "examples": [
                                                        "2026-11-15"
                                                    ]
                                                },
                                                "priority": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "1 = low, 2 = medium, 3 = high; null = not set (an older task without a priority).",
                                                    "examples": [
                                                        2
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "open",
                                                        "closed"
                                                    ]
                                                },
                                                "closed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the task was closed, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the task belongs to, if any."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client: the matter's first client, or the task's own client when it has no matter."
                                                },
                                                "assigned_to_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "assigned_to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "flag_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Submit the statement of defence"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "deadline": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Due date, YYYY-MM-DD.",
                                                    "examples": [
                                                        "2026-11-15"
                                                    ]
                                                },
                                                "priority": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "1 = low, 2 = medium, 3 = high; null = not set (an older task without a priority).",
                                                    "examples": [
                                                        2
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "open",
                                                        "closed"
                                                    ]
                                                },
                                                "closed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the task was closed, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the task belongs to, if any."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client: the matter's first client, or the task's own client when it has no matter."
                                                },
                                                "assigned_to_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "assigned_to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "flag_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tasks/{id}": {
            "get": {
                "operationId": "tasks.get",
                "tags": [
                    "Tasks"
                ],
                "summary": "Get task",
                "description": "Returns one task. Answers 404 when the task does not exist or the user may not see it.",
                "x-scope": "tasks:read",
                "x-flowyer-module": "tasks:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                9876
                            ]
                        },
                        "description": "Task id.",
                        "example": 9876
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Submit the statement of defence"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "deadline": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Due date, YYYY-MM-DD.",
                                                    "examples": [
                                                        "2026-11-15"
                                                    ]
                                                },
                                                "priority": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "1 = low, 2 = medium, 3 = high; null = not set (an older task without a priority).",
                                                    "examples": [
                                                        2
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "open",
                                                        "closed"
                                                    ]
                                                },
                                                "closed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the task was closed, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the task belongs to, if any."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client: the matter's first client, or the task's own client when it has no matter."
                                                },
                                                "assigned_to_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "assigned_to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "flag_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "tasks.update",
                "tags": [
                    "Tasks"
                ],
                "summary": "Update task",
                "description": "Changes a task: subject, deadline, description, priority, flag, assignee or the matter it belongs to. Moving it onto a matter re-derives the court link and drops a direct client; client_id is only for a caseless task. Pass expected_updated_at; a conflicting change answers 409.",
                "x-scope": "tasks:update",
                "x-flowyer-module": "tasks:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "subject": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "What has to be done. Plain text, at most 1000 characters as a NEW value; a longer stored subject may be sent back unchanged. null keeps the current subject."
                                    },
                                    "deadline": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "Due date, YYYY-MM-DD. null keeps the current deadline (a deadline cannot be cleared)."
                                    },
                                    "matter_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Move the task onto this matter (must be visible and not archived), or null to detach it. Sending the task's current matter changes nothing."
                                    },
                                    "client_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Client of a caseless task. Only allowed when the task has no matter."
                                    },
                                    "assigned_to_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "description": "New assignee: an active colleague's user id from colleagues.list. Notified when it is not you. Sending the current one - or null / 0, which a task without an assignee reads back as - changes nothing."
                                    },
                                    "priority": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 3,
                                        "description": "1 = low, 2 = medium, 3 = high. Omit it to keep the current priority (also when the task reads back with priority null); null is refused."
                                    },
                                    "description": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "description": "Longer details, plain text, at most 10000 characters as a NEW value; a longer stored description may be sent back unchanged."
                                    },
                                    "flag_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Id of an office task flag (label), or null to clear it."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Submit the statement of defence"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "deadline": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Due date, YYYY-MM-DD.",
                                                    "examples": [
                                                        "2026-11-15"
                                                    ]
                                                },
                                                "priority": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "1 = low, 2 = medium, 3 = high; null = not set (an older task without a priority).",
                                                    "examples": [
                                                        2
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "open",
                                                        "closed"
                                                    ]
                                                },
                                                "closed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the task was closed, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the task belongs to, if any."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client: the matter's first client, or the task's own client when it has no matter."
                                                },
                                                "assigned_to_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "assigned_to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "flag_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tasks/{id}/close": {
            "post": {
                "operationId": "tasks.close",
                "tags": [
                    "Tasks"
                ],
                "summary": "Close task",
                "description": "Closes a task. If minutes are given it also books a time entry (needs workhours:create and a case: the task's own, or matter_id on a caseless task); billable minutes are clipped to the office hour-cap. A second close answers 409, so a retry never books a second entry.",
                "x-scope": "tasks:update",
                "x-flowyer-module": "tasks:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                9876
                            ]
                        },
                        "description": "Task id.",
                        "example": 9876
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "minutes_spent": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Time spent, in minutes. Booking any time needs the workhours:create scope and a case."
                                    },
                                    "minutes_invoiceable": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Billable minutes; clipped to the office hour-cap."
                                    },
                                    "minutes_normative": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Normative minutes; stored raw, never capped."
                                    },
                                    "matter_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Assign this case to a CASELESS task at close (and so make it possible to book time). Not allowed when the task already has a case."
                                    },
                                    "client_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Direct client (Megbízó) for a caseless task closed without a case."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        9876
                                                    ]
                                                },
                                                "subject": {
                                                    "type": "string",
                                                    "examples": [
                                                        "Submit the statement of defence"
                                                    ]
                                                },
                                                "description": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "deadline": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Due date, YYYY-MM-DD.",
                                                    "examples": [
                                                        "2026-11-15"
                                                    ]
                                                },
                                                "priority": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "1 = low, 2 = medium, 3 = high; null = not set (an older task without a priority).",
                                                    "examples": [
                                                        2
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "open",
                                                        "closed"
                                                    ]
                                                },
                                                "closed_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date",
                                                    "description": "Day the task was closed, YYYY-MM-DD. Flowyer records the date only, no time of day."
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter the task belongs to, if any."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client: the matter's first client, or the task's own client when it has no matter."
                                                },
                                                "assigned_to_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "assigned_to": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_by": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "flag_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                },
                                                "booked_workhour": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "minimum": 1
                                                        },
                                                        "minutes": {
                                                            "type": "integer"
                                                        },
                                                        "minutes_invoiceable": {
                                                            "type": "integer"
                                                        },
                                                        "minutes_normative": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The time entry booked from the close, or null when no time was entered."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets": {
            "get": {
                "operationId": "tickets.list",
                "tags": [
                    "Tickets"
                ],
                "summary": "List tickets",
                "description": "Lists the support tickets the user may see (per-mailbox visibility), newest activity first. Filter by status (default open_states = new+open+pending; \"all\" includes closed), mailbox, assignee, requester email, or free text over subject/requester/ticket number.",
                "x-scope": "tickets:read",
                "x-flowyer-module": "ticketing:read",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "new",
                                "open",
                                "pending",
                                "closed",
                                "open_states",
                                "all"
                            ],
                            "default": "open_states"
                        },
                        "description": "open_states (default) = new+open+pending (the web default view); \"all\" includes closed; or one exact status."
                    },
                    {
                        "name": "mailbox_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                7
                            ]
                        },
                        "description": "Only tickets from this mailbox. A mailbox the user may not see yields an empty list (never a leak).",
                        "example": 7
                    },
                    {
                        "name": "assigned_to_user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        },
                        "description": "Only tickets assigned to this colleague (id from colleagues.list); 0 = only unassigned tickets. Omit for any assignee."
                    },
                    {
                        "name": "requester_email",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 255,
                            "examples": [
                                "ugyfel@example.com"
                            ]
                        },
                        "description": "Only tickets whose external requester email matches exactly (case-insensitive).",
                        "example": "ugyfel@example.com"
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "maxLength": 100,
                            "examples": [
                                "számla"
                            ]
                        },
                        "description": "Free-text search over subject, requester name/email and ticket number (case ignored).",
                        "example": "számla"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Ticket id (use with tickets.get / tickets.update).",
                                                        "examples": [
                                                            4321
                                                        ]
                                                    },
                                                    "ticket_number": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Human ticket number, e.g. FLW-000123."
                                                    },
                                                    "subject": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "new",
                                                            "open",
                                                            "pending",
                                                            "closed"
                                                        ]
                                                    },
                                                    "priority": {
                                                        "type": "string",
                                                        "enum": [
                                                            "low",
                                                            "normal",
                                                            "high"
                                                        ]
                                                    },
                                                    "mailbox": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "email": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "display_name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The mailbox the ticket arrived through (central registry)."
                                                    },
                                                    "requester": {
                                                        "type": "object",
                                                        "properties": {
                                                            "email": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The external person who wrote in."
                                                    },
                                                    "assigned_to": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The colleague the ticket is assigned to, or null when unassigned."
                                                    },
                                                    "matter": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "case_number": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The matter linked to the ticket, or null."
                                                    },
                                                    "client": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "The client linked to the ticket, or null."
                                                    },
                                                    "last_message_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Time of the most recent thread activity; the list is ordered by this, newest first."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Pass this to tickets.update as expected_updated_at."
                                                    },
                                                    "created_via_api": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "key",
                                                                    "oauth"
                                                                ],
                                                                "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                            },
                                                            "key_id": {
                                                                "type": "integer",
                                                                "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                            },
                                                            "key_name": {
                                                                "type": "string",
                                                                "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                            },
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "user": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false,
                                                        "description": "Present when the ticket was created through this API."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}": {
            "get": {
                "operationId": "tickets.get",
                "tags": [
                    "Tickets"
                ],
                "summary": "Get ticket",
                "description": "Returns one support ticket with its message thread (oldest first) and the linked matter/client. Answers 404 when the ticket does not exist or is in a mailbox the user may not see. The read never changes the ticket (a NEW ticket is not flipped to OPEN).",
                "x-scope": "tickets:read",
                "x-flowyer-module": "ticketing:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                4321
                            ]
                        },
                        "description": "Ticket id.",
                        "example": 4321
                    },
                    {
                        "name": "messages_limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 1,
                            "maximum": 500
                        },
                        "description": "Return only the newest N messages of the thread (still presented oldest first). Omit for the whole thread."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Ticket id (use with tickets.get / tickets.update).",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "ticket_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Human ticket number, e.g. FLW-000123."
                                                },
                                                "subject": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "new",
                                                        "open",
                                                        "pending",
                                                        "closed"
                                                    ]
                                                },
                                                "priority": {
                                                    "type": "string",
                                                    "enum": [
                                                        "low",
                                                        "normal",
                                                        "high"
                                                    ]
                                                },
                                                "mailbox": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "display_name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The mailbox the ticket arrived through (central registry)."
                                                },
                                                "requester": {
                                                    "type": "object",
                                                    "properties": {
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external person who wrote in."
                                                },
                                                "assigned_to": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague the ticket is assigned to, or null when unassigned."
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter linked to the ticket, or null."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client linked to the ticket, or null."
                                                },
                                                "last_message_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Time of the most recent thread activity; the list is ordered by this, newest first."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to tickets.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when the ticket was created through this API."
                                                },
                                                "messages": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "direction": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "in",
                                                                    "out",
                                                                    "note"
                                                                ],
                                                                "description": "in = from the requester, out = reply/auto-ack sent from the mailbox, note = internal."
                                                            },
                                                            "from": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "email": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "name": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    }
                                                                },
                                                                "additionalProperties": false
                                                            },
                                                            "to": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "email": {
                                                                            "type": "string"
                                                                        },
                                                                        "name": {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        }
                                                                    },
                                                                    "additionalProperties": false
                                                                }
                                                            },
                                                            "cc": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "email": {
                                                                            "type": "string"
                                                                        },
                                                                        "name": {
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        }
                                                                    },
                                                                    "additionalProperties": false
                                                                }
                                                            },
                                                            "sent_status": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "enum": [
                                                                    "pending",
                                                                    "sent",
                                                                    "failed",
                                                                    "scheduled",
                                                                    null
                                                                ],
                                                                "description": "Delivery state of an outbound message; null for in/note."
                                                            },
                                                            "body_text": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "description": "Message body as plain text. The HTML body is deliberately omitted to keep the thread compact; when the stored text is empty it is rendered down from the HTML."
                                                            },
                                                            "has_attachments": {
                                                                "type": "boolean"
                                                            },
                                                            "author": {
                                                                "type": [
                                                                    "object",
                                                                    "null"
                                                                ],
                                                                "properties": {
                                                                    "user_id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": [
                                                                            "string",
                                                                            "null"
                                                                        ]
                                                                    }
                                                                },
                                                                "additionalProperties": false,
                                                                "description": "The colleague who wrote an out/note message; null for an incoming message."
                                                            },
                                                            "created_at": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "format": "date-time"
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "The message thread, oldest first."
                                                },
                                                "linked_matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter linked to the ticket (same as `matter`)."
                                                },
                                                "linked_client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client linked to the ticket (same as `client`)."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "tickets.update_status",
                "tags": [
                    "Tickets"
                ],
                "summary": "Change ticket status",
                "description": "Changes a ticket's status (new, open, pending or closed). \"closed\" stamps closed_at; any other status clears it. Pass expected_updated_at from your last read; a conflicting change answers 409. Answers 404 when the ticket is not visible.",
                "x-scope": "tickets:update",
                "x-flowyer-module": "ticketing:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "new",
                                            "open",
                                            "pending",
                                            "closed"
                                        ],
                                        "description": "The new status. \"closed\" stamps closed_at; any other status clears it.",
                                        "examples": [
                                            "open"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "status"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Ticket id (use with tickets.get / tickets.update).",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "ticket_number": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Human ticket number, e.g. FLW-000123."
                                                },
                                                "subject": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "new",
                                                        "open",
                                                        "pending",
                                                        "closed"
                                                    ]
                                                },
                                                "priority": {
                                                    "type": "string",
                                                    "enum": [
                                                        "low",
                                                        "normal",
                                                        "high"
                                                    ]
                                                },
                                                "mailbox": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "display_name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The mailbox the ticket arrived through (central registry)."
                                                },
                                                "requester": {
                                                    "type": "object",
                                                    "properties": {
                                                        "email": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The external person who wrote in."
                                                },
                                                "assigned_to": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague the ticket is assigned to, or null when unassigned."
                                                },
                                                "matter": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter linked to the ticket, or null."
                                                },
                                                "client": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The client linked to the ticket, or null."
                                                },
                                                "last_message_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Time of the most recent thread activity; the list is ordered by this, newest first."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to tickets.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when the ticket was created through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tickets/{id}/reply": {
            "post": {
                "operationId": "tickets.reply",
                "tags": [
                    "Tickets"
                ],
                "summary": "Reply to ticket",
                "description": "Replies to a support ticket and SENDS the reply by email to the external requester (through the ticket's mailbox). The body is rich HTML, sanitised server-side before store. A retry with the same Idempotency-Key never sends a second email.",
                "x-scope": "tickets:reply",
                "x-flowyer-module": "ticketing:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                4321
                            ]
                        },
                        "description": "Ticket id (must be visible via the mailbox ACL).",
                        "example": 4321
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "body_html": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "The reply, rich HTML (as TinyMCE produces). Server-side HTMLPurifier-cleaned before store and before sending. At most 100000 characters; rejected if it sanitises to nothing.",
                                        "examples": [
                                            "<p>Köszönjük megkeresését, csatoltan küldjük a választ.</p>"
                                        ]
                                    },
                                    "cc": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "description": "An email address."
                                        },
                                        "maxItems": 10,
                                        "description": "Extra Cc recipients (at most 10). The requester and the mailbox are excluded automatically; an invalid address answers 422."
                                    },
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "new",
                                            "open",
                                            "pending",
                                            "closed"
                                        ],
                                        "description": "Ticket status to set after replying (default \"pending\" = waiting for the requester). Records a status-change event.",
                                        "default": "pending"
                                    },
                                    "append_signature": {
                                        "type": "boolean",
                                        "description": "Append the key user's saved ticket signature to the OUTGOING mail only (never stored in the thread).",
                                        "default": false
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "body_html"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ticket_id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "message_id": {
                                                    "type": "integer",
                                                    "description": "Id of the created outbound ticket_messages row.",
                                                    "examples": [
                                                        98765
                                                    ]
                                                },
                                                "direction": {
                                                    "type": "string",
                                                    "description": "Always \"out\"."
                                                },
                                                "sent_status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "pending",
                                                        "sent",
                                                        "failed",
                                                        "scheduled",
                                                        null
                                                    ],
                                                    "description": "\"pending\" at create time; the async send flips it to sent/failed later."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "new",
                                                        "open",
                                                        "pending",
                                                        "closed"
                                                    ],
                                                    "description": "The ticket status after the reply."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when the reply was created through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "ticket_id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "message_id": {
                                                    "type": "integer",
                                                    "description": "Id of the created outbound ticket_messages row.",
                                                    "examples": [
                                                        98765
                                                    ]
                                                },
                                                "direction": {
                                                    "type": "string",
                                                    "description": "Always \"out\"."
                                                },
                                                "sent_status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "pending",
                                                        "sent",
                                                        "failed",
                                                        "scheduled",
                                                        null
                                                    ],
                                                    "description": "\"pending\" at create time; the async send flips it to sent/failed later."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "new",
                                                        "open",
                                                        "pending",
                                                        "closed"
                                                    ],
                                                    "description": "The ticket status after the reply."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when the reply was created through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/trials/{id}": {
            "get": {
                "operationId": "trials.get",
                "tags": [
                    "Trials"
                ],
                "summary": "Get hearing",
                "description": "Returns one court hearing (tárgyalás) with its matter, court, attending colleagues and the updated_at lock token for trials.update. Answers 404 when the hearing does not exist or the user may not see its matter.",
                "x-scope": "trials:read",
                "x-flowyer-module": "trials:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                4321
                            ]
                        },
                        "description": "Hearing id.",
                        "example": 4321
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter (case) the hearing belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Hearing date and time, ISO 8601 in the office time zone. It is stored in UTC, so compare instants rather than the wall-clock text.",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "participation": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "required",
                                                        "not_required",
                                                        null
                                                    ],
                                                    "description": "Whether a colleague's attendance is required: \"required\", \"not_required\", or null when unset."
                                                },
                                                "court": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "address": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "source": {
                                                            "type": "string",
                                                            "description": "Always \"registry\": the court is a reference to the shared court registry (courts.list), not free text."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The court of the hearing, resolved from the shared court registry; null when no court is set."
                                                },
                                                "place": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Room or location of the hearing. Plain text."
                                                },
                                                "name_of_the_judge": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Name of the judge. Plain text."
                                                },
                                                "notes": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Free-text notes on the hearing. Plain text."
                                                },
                                                "responsibles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Colleagues attending the hearing (ids from colleagues.list)."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who recorded the hearing."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to trials.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "trials.update",
                "tags": [
                    "Trials"
                ],
                "summary": "Update hearing",
                "description": "Updates a court hearing (tárgyalás): its time, court, place, judge, notes, attendance flag and attendees. Writes only the fields you send; send responsible_user_ids to replace the whole attendee list. Pass expected_updated_at from your last read; a conflicting change answers 409.",
                "x-scope": "trials:update",
                "x-flowyer-module": "trials:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date-time",
                                        "description": "New hearing date and time, ISO 8601 (an offset is honoured, a naive time is read in the office zone). Stored in UTC.",
                                        "examples": [
                                            "2026-03-02T09:00:00+01:00"
                                        ]
                                    },
                                    "court_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "New court id from courts.list; null to clear the court."
                                    },
                                    "participation": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "required",
                                            "not_required",
                                            null
                                        ],
                                        "description": "Whether a colleague's attendance is required; null to clear it."
                                    },
                                    "place": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Room or location. Plain text; \"<\" and \">\" are not allowed. \"\" clears it."
                                    },
                                    "name_of_the_judge": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255,
                                        "pattern": "^[^<>]*$",
                                        "description": "Name of the judge. Plain text; \"<\" and \">\" are not allowed. \"\" clears it."
                                    },
                                    "notes": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 10000,
                                        "pattern": "^[^<>]*$",
                                        "description": "Free-text notes. Plain text; \"<\" and \">\" are not allowed. \"\" clears it."
                                    },
                                    "responsible_user_ids": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "description": "Full replacement set of attendee user ids (from colleagues.list). Omit to leave the attendees unchanged."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "examples": [
                                                        4321
                                                    ]
                                                },
                                                "matter": {
                                                    "type": "object",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "case_number": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The matter (case) the hearing belongs to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Hearing date and time, ISO 8601 in the office time zone. It is stored in UTC, so compare instants rather than the wall-clock text.",
                                                    "examples": [
                                                        "2026-03-02T09:00:00+01:00"
                                                    ]
                                                },
                                                "participation": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "enum": [
                                                        "required",
                                                        "not_required",
                                                        null
                                                    ],
                                                    "description": "Whether a colleague's attendance is required: \"required\", \"not_required\", or null when unset."
                                                },
                                                "court": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "city": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "zip": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "address": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "source": {
                                                            "type": "string",
                                                            "description": "Always \"registry\": the court is a reference to the shared court registry (courts.list), not free text."
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The court of the hearing, resolved from the shared court registry; null when no court is set."
                                                },
                                                "place": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Room or location of the hearing. Plain text."
                                                },
                                                "name_of_the_judge": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Name of the judge. Plain text."
                                                },
                                                "notes": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Free-text notes on the hearing. Plain text."
                                                },
                                                "responsibles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "additionalProperties": false
                                                    },
                                                    "description": "Colleagues attending the hearing (ids from colleagues.list)."
                                                },
                                                "recorded_by": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "The colleague who recorded the hearing."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Pass this to trials.update as expected_updated_at."
                                                },
                                                "created_via_api": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                                "key",
                                                                "oauth"
                                                            ],
                                                            "description": "\"key\": created with a static API key; \"oauth\": created by an app connected through OAuth."
                                                        },
                                                        "key_id": {
                                                            "type": "integer",
                                                            "description": "Id of the API key (kind \"key\") or of the connected app (kind \"oauth\"); the two are numbered separately."
                                                        },
                                                        "key_name": {
                                                            "type": "string",
                                                            "description": "Name the user gave the API key, e.g. \"Grok integration\", or the connected app's name for kind \"oauth\", e.g. \"Claude\"."
                                                        },
                                                        "user_id": {
                                                            "type": "integer"
                                                        },
                                                        "user": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "format": "date-time"
                                                        }
                                                    },
                                                    "additionalProperties": false,
                                                    "description": "Present when an external agent created the record through this API."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/workhours": {
            "get": {
                "operationId": "workhours.list",
                "tags": [
                    "Workhours"
                ],
                "summary": "List time entries",
                "description": "Lists live (not yet invoiced) time entries on matters the user may see, newest first. Filter by matter, responsible colleague or date range. Entries excluded from the summary are listed too, flagged excluded: true; leave them out of billable totals.",
                "x-scope": "workhours:read",
                "x-flowyer-module": "workhours:read",
                "parameters": [
                    {
                        "name": "matter_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "examples": [
                                1234
                            ]
                        },
                        "description": "Only entries on this matter.",
                        "example": 1234
                    },
                    {
                        "name": "responsible_user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Only entries booked to this colleague (a user id from colleagues.list)."
                    },
                    {
                        "name": "date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Only entries on or after this date (YYYY-MM-DD)."
                    },
                    {
                        "name": "date_to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Only entries on or before this date (YYYY-MM-DD)."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "examples": [
                                25
                            ],
                            "default": 25
                        },
                        "description": "Page size, 1-100. Default 25.",
                        "example": 25
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "examples": [
                                0
                            ],
                            "default": 0
                        },
                        "description": "Number of records to skip. Use offset + limit of the previous page to get the next one; `pagination.total` is the full count.",
                        "example": 0
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Time entry id."
                                                    },
                                                    "matter_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Matter the entry is booked to."
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date"
                                                    },
                                                    "activity": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "What was done (plain text)."
                                                    },
                                                    "minutes": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Minutes spent."
                                                    },
                                                    "minutes_invoiceable": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Billable minutes after the office hour-cap was applied (may be lower than requested). They count towards billing only while excluded is false."
                                                    },
                                                    "minutes_normative": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Normative minutes (informational; never capped)."
                                                    },
                                                    "responsible_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Colleague the time is booked to."
                                                    },
                                                    "responsible": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "recorded_by_user_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "Who recorded the entry."
                                                    },
                                                    "locked": {
                                                        "type": "boolean",
                                                        "description": "True when the entry is locked (read-only through the API)."
                                                    },
                                                    "excluded": {
                                                        "type": "boolean",
                                                        "description": "True when a colleague excluded the entry from the matter summary: it is not billed and its minutes are left out of the billable totals."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "format": "date-time",
                                                        "description": "Send this back as expected_updated_at when updating."
                                                    }
                                                },
                                                "additionalProperties": false
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "pagination"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "workhours.create",
                "tags": [
                    "Workhours"
                ],
                "summary": "Record time entry",
                "description": "Records a time entry on a matter: date, activity, minutes spent and billable minutes. Omitted billable minutes mean not billable: send minutes_invoiceable for billable work. They are clipped to the office hour-cap. The responsible colleague defaults to the key's user and is notified otherwise.",
                "x-scope": "workhours:create",
                "x-flowyer-module": "workhours:create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "matter_id": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Matter the time is booked to (must be visible).",
                                        "examples": [
                                            1234
                                        ]
                                    },
                                    "date": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Date of the work, YYYY-MM-DD.",
                                        "examples": [
                                            "2026-10-30"
                                        ]
                                    },
                                    "subject": {
                                        "type": "string",
                                        "maxLength": 1000,
                                        "minLength": 2,
                                        "pattern": "^[^<>]*$",
                                        "description": "What was done; the read side returns it as `activity` and either name is accepted here (one of the two is required). Plain text; \"<\" and \">\" are not allowed.",
                                        "examples": [
                                            "Drafting the statement of claim"
                                        ]
                                    },
                                    "activity": {
                                        "type": "string",
                                        "maxLength": 1000,
                                        "minLength": 2,
                                        "pattern": "^[^<>]*$",
                                        "description": "The same field as `subject`, under the name the read side uses. Send one of the two."
                                    },
                                    "minutes": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Minutes actually spent.",
                                        "examples": [
                                            90
                                        ]
                                    },
                                    "minutes_invoiceable": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Billable minutes requested. Omitted or null = not billable (the entry bills nothing; they are not derived from minutes): for billable work send them explicitly, usually equal to minutes. The office hour-cap may reduce the stored value. They count towards billing only while the entry is not excluded from the summary.",
                                        "examples": [
                                            60
                                        ]
                                    },
                                    "minutes_normative": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Normative minutes (informational; never capped)."
                                    },
                                    "responsible_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "description": "Colleague the time is booked to: a user id from colleagues.list (look a dictated name up there). Default: the user behind the key."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$",
                                        "description": "Same role as the Idempotency-Key header, for clients that cannot send custom headers. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                                        "examples": [
                                            "b8f1c2e0-6f7a-4d2e-9c1b-2a3d4e5f6a7b"
                                        ]
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "matter_id",
                                    "date"
                                ],
                                "anyOf": [
                                    {
                                        "required": [
                                            "subject"
                                        ]
                                    },
                                    {
                                        "required": [
                                            "activity"
                                        ]
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Idempotent replay: this Idempotency-Key (or, without a key, an identical request within 120 seconds) already created the record; it is returned again, nothing new was created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Time entry id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the entry is booked to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "What was done (plain text)."
                                                },
                                                "minutes": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Minutes spent."
                                                },
                                                "minutes_invoiceable": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Billable minutes after the office hour-cap was applied (may be lower than requested). They count towards billing only while excluded is false."
                                                },
                                                "minutes_normative": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Normative minutes (informational; never capped)."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Colleague the time is booked to."
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Who recorded the entry."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the entry is locked (read-only through the API)."
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the entry from the matter summary: it is not billed and its minutes are left out of the billable totals."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": false
                                        },
                                        "idempotent_replay": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Time entry id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the entry is booked to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "What was done (plain text)."
                                                },
                                                "minutes": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Minutes spent."
                                                },
                                                "minutes_invoiceable": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Billable minutes after the office hour-cap was applied (may be lower than requested). They count towards billing only while excluded is false."
                                                },
                                                "minutes_normative": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Normative minutes (informational; never capped)."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Colleague the time is booked to."
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Who recorded the entry."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the entry is locked (read-only through the API)."
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the entry from the matter summary: it is not billed and its minutes are left out of the billable totals."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "created": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user. `replay_not_visible`: this Idempotency-Key (or, without a key, an identical request) already created the record (`details.record_id`), but it has since been deleted or is not visible to the user; nothing new was created, do not create it again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The Idempotency-Key was used for another resource type (`idempotency_key_reused`), or, without a key, an identical request is being processed right now (`duplicate_in_progress`; retry shortly).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/workhours/{id}": {
            "get": {
                "operationId": "workhours.get",
                "tags": [
                    "Workhours"
                ],
                "summary": "Get time entry",
                "description": "Returns one live time entry by id, if its matter is visible to the user.",
                "x-scope": "workhours:read",
                "x-flowyer-module": "workhours:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Time entry id."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Time entry id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the entry is booked to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "What was done (plain text)."
                                                },
                                                "minutes": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Minutes spent."
                                                },
                                                "minutes_invoiceable": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Billable minutes after the office hour-cap was applied (may be lower than requested). They count towards billing only while excluded is false."
                                                },
                                                "minutes_normative": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Normative minutes (informational; never capped)."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Colleague the time is booked to."
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Who recorded the entry."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the entry is locked (read-only through the API)."
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the entry from the matter summary: it is not billed and its minutes are left out of the billable totals."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "workhours.update",
                "tags": [
                    "Workhours"
                ],
                "summary": "Update time entry",
                "description": "Changes a live time entry: date, activity (`subject` or `activity`), minutes, billable minutes (a changed number is clipped to the hour-cap, an echoed one kept) and the responsible colleague. A locked or invoiced entry cannot be changed (409). Pass expected_updated_at; a conflict answers 409.",
                "x-scope": "workhours:update",
                "x-flowyer-module": "workhours:modify",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Id of the record to modify."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expected_updated_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time",
                                        "description": "The `updated_at` value from your most recent read of this record (required whenever the record has one). If the record changed since (a colleague edited it), the API answers 409 and you must re-read before retrying. A legacy record whose `updated_at` is null takes null."
                                    },
                                    "date": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date",
                                        "description": "Date of the work, YYYY-MM-DD. null keeps the current date."
                                    },
                                    "subject": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "What was done, the value the read side returns as `activity` (either name is accepted; null under one of them is \"not given\", only two different texts are refused). Plain text, at most 1000 characters as a NEW value; \"<\" and \">\" cannot be introduced either, but a stored text that is longer or contains them may be sent back unchanged. null keeps the current text."
                                    },
                                    "activity": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "minLength": 1,
                                        "description": "The same field as `subject`, under the name the read side uses. Send one of the two (null under the other one is fine)."
                                    },
                                    "minutes": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Minutes actually spent; null clears them."
                                    },
                                    "minutes_invoiceable": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Billable minutes requested. A number different from the stored one is clipped to what is left of the hour-cap; re-sending the value the read returned keeps it as recorded (it is not clipped again). null clears them. They count towards billing only while the entry is not excluded from the summary (excluded is false)."
                                    },
                                    "minutes_normative": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Normative minutes (never capped); null clears them."
                                    },
                                    "responsible_user_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 0,
                                        "description": "New responsible colleague: an active colleague's user id from colleagues.list; notified when it is not you. Sending the current one - or null / 0, which an entry without a responsible reads back as - changes nothing."
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Time entry id."
                                                },
                                                "matter_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Matter the entry is booked to."
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date"
                                                },
                                                "activity": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "What was done (plain text)."
                                                },
                                                "minutes": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Minutes spent."
                                                },
                                                "minutes_invoiceable": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Billable minutes after the office hour-cap was applied (may be lower than requested). They count towards billing only while excluded is false."
                                                },
                                                "minutes_normative": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Normative minutes (informational; never capped)."
                                                },
                                                "responsible_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Colleague the time is booked to."
                                                },
                                                "responsible": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "recorded_by_user_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Who recorded the entry."
                                                },
                                                "locked": {
                                                    "type": "boolean",
                                                    "description": "True when the entry is locked (read-only through the API)."
                                                },
                                                "excluded": {
                                                    "type": "boolean",
                                                    "description": "True when a colleague excluded the entry from the matter summary: it is not billed and its minutes are left out of the billable totals."
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time"
                                                },
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "format": "date-time",
                                                    "description": "Send this back as expected_updated_at when updating."
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "updated": {
                                            "type": "boolean",
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Malformed request: invalid JSON body, wrong host (use the www. host), or an unreadable request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "The key is missing, invalid, revoked or expired, or its user is no longer active.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Missing scope (`scope_missing`), missing Flowyer module permission (`module_forbidden`), API disabled for the office, licence expired or office archived.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown endpoint, or the record does not exist / is not visible to the user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "405": {
                        "description": "Method not offered on this path (DELETE and PUT never are; PATCH only where an update is offered).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The record changed since you read it (`record_conflict`: expected_updated_at no longer matches; read it again and retry with the new updated_at), or it has been invoiced / locked and can no longer be modified through the API (`record_locked`; make the change in Flowyer).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "The request body is too large (`request_too_large`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed or unknown field; `details.fields` lists the field errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded; `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The office is temporarily unavailable (maintenance or setup in progress); `Retry-After` says when to retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Any other error, in the same envelope.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "A personal Flowyer API key (\"flw_...\"), created by the user under Settings > API keys. Send it as \"Authorization: Bearer <key>\" on every request."
            }
        },
        "parameters": {
            "IdempotencyKey": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": false,
                "description": "Recommended on every create. A unique value per logical operation (e.g. a UUID). The same value returns the same record: retrying with it returns the record created the first time instead of creating a second one. Different values always create different records. Clients that cannot send headers may pass the same value in the `idempotency_key` body field. Letters, digits, `_`, `-`, `:` or `.`, at most 128 characters.",
                "schema": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_\\-:.]{1,128}$"
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string",
                        "description": "Machine-readable code, e.g. scope_missing, not_found, validation_failed, rate_limited."
                    },
                    "message": {
                        "type": "string",
                        "description": "English explanation incl. what to do next."
                    },
                    "message_localized": {
                        "type": "string",
                        "description": "The same in the office language."
                    },
                    "locale": {
                        "type": "string",
                        "enum": [
                            "hu",
                            "en",
                            "de",
                            "it",
                            "ro"
                        ]
                    },
                    "details": {
                        "type": "object",
                        "additionalProperties": true
                    },
                    "request_id": {
                        "type": "string"
                    }
                },
                "required": [
                    "error",
                    "message",
                    "message_localized",
                    "locale"
                ]
            },
            "Pagination": {
                "type": "object",
                "properties": {
                    "limit": {
                        "type": "integer"
                    },
                    "offset": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer",
                        "description": "Total number of matching records."
                    }
                },
                "required": [
                    "limit",
                    "offset",
                    "total"
                ]
            }
        }
    }
}