{
    "openapi": "3.1.0",
    "info": {
        "title": "Monotree Partners API",
        "version": "1.0.0",
        "summary": "Sign up, configure and follow Monotree customers from your own systems.",
        "description": "Run your Monotree partnership from your own system: sign up customers and follow them to live, change, suspend and\ncancel them, credit them to your sellers, read their statistics and your monthly statement, answer their support\nthreads, and hear about every change through signed webhooks. A few things stay in the portal, such as a person's\nown password and two-factor sign-in; the guide \"Run everything from your own system\" lists them.\n\nYou may make 120 requests a minute. The count is per partner and mode: all your live tokens share one count and\nall your sandbox tokens another. A few calls that send email or ask Monotree's people for something have a lower\nlimit of their own. A refused call answers `429 rate_limited` with a `Retry-After` header; the guide \"Rate\nlimits\" has the numbers.\n\nEvery `GET` refuses a query parameter it does not take with `422 validation_error`, naming it in `fields`: a typo\nin a filter never returns the whole list. In a JSON body, fields we do not know are ignored. A body that is not\nvalid JSON answers `400 invalid_json`.\n",
        "contact": {
            "name": "Monotree partner support",
            "url": "https://partners.monotree.com/docs"
        }
    },
    "servers": [
        {
            "url": "https://partners.monotree.com/api/v1",
            "description": "Production. Sandbox and live are told apart by the token, not by the URL."
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "tags": [
        {
            "name": "Customers",
            "description": "The companies you sign up. A customer is created, set up and live in about a minute. Wherever a path takes a customer's ID (`cus_\u2026`), you can send `external_ref:` followed by your own reference instead, such as `/customers/external_ref:org_48213`."
        },
        {
            "name": "Company IDs",
            "description": "A company ID is a customer's address (`boulangeriemartin.monotree.com`) and what its employees type in the Monotree app."
        },
        {
            "name": "Events",
            "description": "Every event your webhook endpoints were sent, or would have been sent, kept for 90 days. Read them to catch up after your server was down, or to start a new system from what already happened."
        },
        {
            "name": "Webhooks",
            "description": "Endpoints on your side that Monotree calls when something changes, and the deliveries made to them."
        },
        {
            "name": "Sellers",
            "description": "The people at your company who sign up customers. Every customer is credited to one seller."
        },
        {
            "name": "Security",
            "description": "How your people sign in to the portal: two-factor sign-in, passkeys and the sign-in log."
        },
        {
            "name": "Statistics",
            "description": "How your live customers use Monotree, from numbers collected every night: one customer, all of them together, and what the numbers mean."
        },
        {
            "name": "Adoption",
            "description": "Alerts for live customers that stall: few employees signed in, activity dropped, or the numbers stopped coming."
        },
        {
            "name": "Statement",
            "description": "Your month as Monotree counts it for the statement: live customers and their employees, per seller and per customer."
        },
        {
            "name": "Support threads",
            "description": "The conversations of your support desk: what the employees and admins of your customers ask, in their app or by email. The [support guide](/docs/support) explains the model."
        },
        {
            "name": "Support messages",
            "description": "The messages in a support thread: answers, internal notes and attached files."
        },
        {
            "name": "Support assistant",
            "description": "The assistant that drafts answers for your support desk: its drafts, and what it has been taught."
        },
        {
            "name": "Support escalations",
            "description": "Support threads handed to Monotree because they need a fix or an answer from Monotree."
        },
        {
            "name": "Support desk",
            "description": "How your support desk is set up: its settings, whether it is online, and its numbers."
        },
        {
            "name": "Tokens",
            "description": "The API tokens of your company."
        },
        {
            "name": "Partner",
            "description": "Your company, and the token you are calling with."
        }
    ],
    "paths": {
        "/partner": {
            "get": {
                "tags": [
                    "Partner"
                ],
                "operationId": "getPartner",
                "summary": "Who am I",
                "description": "Your company (the partner), the token you are calling with and what it may do, and the version of the API. Needs no ability, so it is a good first call to check a token.",
                "responses": {
                    "200": {
                        "description": "The partner and the token.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Partner"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/company-ids/{name}": {
            "get": {
                "tags": [
                    "Company IDs"
                ],
                "operationId": "checkCompanyId",
                "summary": "Check a company ID",
                "description": "Whether a company ID is free, and a free one close to it when it is not. `reason` says why not: `taken` (a customer has it), `reserved` (Monotree keeps it for itself) or `invalid` (too short, too long, or other signs than lower-case letters and digits). Check before you create a customer, or let the create call tell you with a `422`.",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "name",
                        "in": "path",
                        "required": true,
                        "description": "The company ID to check: 3 to 40 lower-case letters and digits, never a hyphen. Capital letters are read as lower case.",
                        "schema": {
                            "type": "string",
                            "example": "boulangeriemartin"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Whether the company ID is available.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CompanyIdCheck"
                                },
                                "examples": {
                                    "available": {
                                        "value": {
                                            "object": "company_id",
                                            "company_id": "boulangeriemartin",
                                            "available": true,
                                            "reason": null,
                                            "suggestion": null
                                        }
                                    },
                                    "taken": {
                                        "value": {
                                            "object": "company_id",
                                            "company_id": "lepetitbistrot",
                                            "available": false,
                                            "reason": "taken",
                                            "suggestion": "lepetitbistrot2"
                                        }
                                    },
                                    "invalid": {
                                        "value": {
                                            "object": "company_id",
                                            "company_id": "le-petit-bistrot",
                                            "available": false,
                                            "reason": "invalid",
                                            "suggestion": "lepetitbistrot"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers": {
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "listCustomers",
                "summary": "List customers",
                "description": "Your customers, newest first by when they were created (lists cannot be sorted another way). Deleted customers are left out unless you ask for them with `status=deleted`. To check a copy on your side, ask for `updated_since` the time of your last call. Each customer in the list is the whole customer, as Get a customer returns it.",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only customers in this state: `draft`, `provisioning`, `live`, `failed`, `suspended`, `cancelled` or `deleted`. Several states as a comma list (`status=live,suspended`) or repeated (`status[]=live&status[]=suspended`).",
                        "schema": {
                            "type": "string",
                            "example": "live,suspended"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only customers changed at or after this time (their `updated_at`): any change to their settings or state.",
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2026-11-14T08:00:00Z"
                        }
                    },
                    {
                        "name": "created_after",
                        "in": "query",
                        "description": "Only customers created after this time.",
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2026-11-01T00:00:00Z"
                        }
                    },
                    {
                        "name": "country",
                        "in": "query",
                        "description": "Only customers in this country.",
                        "schema": {
                            "$ref": "#/components/schemas/Country"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/SellerFilter"
                    },
                    {
                        "name": "adoption",
                        "in": "query",
                        "description": "`stalling`: only customers with an open adoption alert (their `adoption` is not null).",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "stalling"
                            ]
                        }
                    },
                    {
                        "name": "external_ref",
                        "in": "query",
                        "description": "Only the customer with this reference of your own.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120,
                            "example": "org_48213"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "description": "Only customers whose company name, company ID or admin email contains this text.",
                        "schema": {
                            "type": "string",
                            "maxLength": 80,
                            "example": "bistro"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of customers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CustomerList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Customers"
                ],
                "operationId": "createCustomer",
                "summary": "Create a customer",
                "description": "Creates the customer and starts setting it up at once: it is `provisioning`, then `live` in about a minute, and\nits admin gets an invitation by email. Send `draft: true` to only save it and submit it later. The\n`Idempotency-Key` header is required, so a retry after a timeout never creates a second customer.\n",
                "x-ability": "customers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CustomerCreate"
                            },
                            "example": {
                                "company_name": "Boulangerie Martin",
                                "company_id": "boulangeriemartin",
                                "country": "FR",
                                "employees": 18,
                                "default_language": "fr",
                                "languages": [
                                    "fr",
                                    "en"
                                ],
                                "admin": {
                                    "name": "Claire Martin",
                                    "email": "claire@boulangeriemartin.example",
                                    "phone": "+33 6 12 34 56 78"
                                },
                                "brand": {
                                    "primary_color": "#b45309"
                                },
                                "seller_ref": "usr_20503",
                                "seller_name": "Emma Dubois",
                                "external_ref": "org_48213",
                                "terms_accepted": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The customer: `provisioning`, or `draft` when you sent `draft: true`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`idempotency_key_required`: the `Idempotency-Key` header is missing. `invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`company_id_busy` or `external_ref_busy`: another request is taking the same company ID or `external_ref` right now; try again in a moment. `limit_reached`: you have 200 drafts in this mode already, or 500 customers in the sandbox that are not cancelled. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running. `idempotency_key_taken`: the key was used by another of your tokens."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/duplicates": {
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "findCustomerDuplicates",
                "summary": "Find look-alike customers",
                "description": "Customers of yours that look like one you are about to create: the same company under a slightly different name (legal forms such as SARL or Ltd, accents and a typo are seen through), or the same admin email. Drafts are included, deleted customers are not. It is a warning to show a person, never a refusal: creating the customer still works. At most three per kind of match. Send `company_name`, `admin_email` or both.",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "company_name",
                        "in": "query",
                        "description": "The name of the company you are about to create.",
                        "schema": {
                            "type": "string",
                            "maxLength": 80,
                            "example": "Boulangerie Martin SARL"
                        }
                    },
                    {
                        "name": "admin_email",
                        "in": "query",
                        "description": "The email of its admin.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120,
                            "example": "claire@boulangeriemartin.example"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The look-alikes, possibly none. Never more than one page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CustomerDuplicateList"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "getCustomer",
                "summary": "Get a customer",
                "description": "One customer with its state and, while it is being set up, the step it is on.",
                "x-ability": "customers:read",
                "responses": {
                    "200": {
                        "description": "The customer.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Customers"
                ],
                "operationId": "updateCustomer",
                "summary": "Change a customer",
                "description": "Changes the settings of a customer: send only the fields that change. The change is kept at once and Monotree\napplies it to the customer's app, usually within a minute; `changes_pending` is true until then, and a\n`customer.applied` event follows (`customer.apply_failed` if it could not be applied). The company ID cannot\nchange once the customer is submitted, except while its setup is `failed`. An `external_ref` another customer\nof yours already has is refused. A call that changes nothing answers `200` and sends no event.\n",
                "x-ability": "customers:write",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CustomerUpdate"
                            },
                            "example": {
                                "languages": [
                                    "fr",
                                    "en",
                                    "es"
                                ],
                                "brand": {
                                    "primary_color": "#9a3412",
                                    "logo_light": {
                                        "format": "svg",
                                        "content": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIC8+"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The changed customer.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`customer_closed`: a cancelled or deleted customer cannot be changed. `company_id_busy`: another request is taking the same company ID right now."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: a token changed `admin.email` of this customer more than 3 times in a day (each new address is a new invitation; a draft is not counted), or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            },
            "delete": {
                "tags": [
                    "Customers"
                ],
                "operationId": "cancelCustomer",
                "summary": "Cancel a customer",
                "description": "A draft is deleted at once (`status: deleted`). Any other customer is cancelled: its employees lose access\nright away and the company with all its data is deleted after 30 days (`delete_after`); a `customer.deleted`\nevent tells you when. Contact Monotree to undo a cancellation before then. Safe to repeat: for a customer that\nis already cancelled or deleted the answer is `200` with the customer, and nothing changes.\n",
                "x-ability": "customers:write",
                "responses": {
                    "200": {
                        "description": "The customer: `cancelled`, or `deleted` when it was a draft.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the customer changed state while the call ran; read it and try again."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}/submit": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "post": {
                "tags": [
                    "Customers"
                ],
                "operationId": "submitCustomer",
                "summary": "Submit a draft",
                "description": "Starts setting up a customer that was created with `draft: true`. A draft may be unfinished, so this is where everything is checked: the draft must by now hold all that Create a customer requires (`company_id`, `country`, `employees`, `default_language`, `admin.name`, `admin.email`), and the terms must be accepted, when the draft was made or in this call. What is missing is answered with `422` and named in `fields`, as Create a customer names it; fill it in with Update a customer and submit again.",
                "x-ability": "customers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "terms_accepted": {
                                        "type": "boolean",
                                        "const": true,
                                        "description": "The customer has agreed to the Monotree terms and data processing agreement. Needed when the draft was made without it."
                                    }
                                }
                            },
                            "example": {
                                "terms_accepted": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The customer, provisioning.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: only a draft can be submitted. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: the draft is not finished, or the terms are not accepted; `fields` says what is missing. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}/suspend": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "post": {
                "tags": [
                    "Customers"
                ],
                "operationId": "suspendCustomer",
                "summary": "Suspend a customer",
                "description": "Pauses a live customer: its employees can no longer sign in, and all data is kept. Resume at any time. Use it, for example, when your customer stops paying you.",
                "x-ability": "customers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reason": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 200,
                                        "description": "Why, in your own words. Kept on the customer's timeline and sent in the `customer.suspended` event.",
                                        "example": "Subscription unpaid"
                                    }
                                }
                            },
                            "example": {
                                "reason": "Subscription unpaid"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The suspended customer.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: only a live customer can be suspended. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}/resume": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "post": {
                "tags": [
                    "Customers"
                ],
                "operationId": "resumeCustomer",
                "summary": "Resume a customer",
                "description": "Gives a suspended customer's employees their access back.",
                "x-ability": "customers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The live customer.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: only a suspended customer can be resumed. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}/retry": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "post": {
                "tags": [
                    "Customers"
                ],
                "operationId": "retryCustomer",
                "summary": "Retry a failed setup",
                "description": "Starts the setup again for a customer whose setup stopped (`failed`), from the step it stopped on. Fix what `failure_reason` names first, often with [Change a customer](/docs/reference/customers#update-customer).",
                "x-ability": "customers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The customer, provisioning.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: only a customer whose setup failed can be retried. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}/admin-invite": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "post": {
                "tags": [
                    "Customers"
                ],
                "operationId": "resendAdminInvite",
                "summary": "Resend the admin invitation",
                "description": "Sends the customer's admin a new invitation email. Only for a live customer.",
                "x-ability": "customers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The customer.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: only a live customer has an admin to invite. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 1 invitation in 10 minutes for this customer, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/customers/{customer}/events": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "listCustomerEvents",
                "summary": "List a customer's events",
                "description": "Every event about one customer, with who did what: the same events, in the same shape and with the same filters, as [List events](/docs/reference/events#list-events) with `customer`. Newest first unless `after` or `order` says otherwise. Events are kept for 90 days, and a token only gets the events it may read.",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Only events of this type, such as `customer.live`. One type per call. A type that does not exist answers `422`.",
                        "schema": {
                            "type": "string",
                            "maxLength": 80,
                            "example": "customer.live"
                        }
                    },
                    {
                        "name": "created_after",
                        "in": "query",
                        "description": "Only events that happened after this time.",
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2026-11-14T08:00:00Z"
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "description": "Only events that came after the event with this ID, oldest first unless `order` says otherwise. `404` when the event is unknown or older than 90 days: use `created_after` then.",
                        "schema": {
                            "type": "string",
                            "example": "evt_01jcz8wg4h7v3y6n9q2k5m8p1r"
                        }
                    },
                    {
                        "name": "order",
                        "in": "query",
                        "description": "`desc` newest first, `asc` oldest first. Defaults to `desc`, or to `asc` when `after` is sent.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "asc",
                                "desc"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of events.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/EventList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer, or the event named in `after` is unknown or older than 90 days."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/events": {
            "get": {
                "tags": [
                    "Events"
                ],
                "operationId": "listEvents",
                "summary": "List events",
                "description": "The events of the token's mode (live or sandbox), exactly as their webhooks carried them, whether or not an\nendpoint was listening. Newest first by default. To catch up, send `after` with the `id` of the last event\nyou handled: the events that came after it are returned oldest first, so you can handle them in order and go\non with `next_cursor` until `has_more` is false. Events are kept for 90 days. Test events (`ping`) are not\nin this list. A token only gets the events it may read: besides `customers:read`, `support.*` events\nneed the `support:read` ability, `webhook_endpoint.*` events `webhooks:manage` and `security.*` events\n`security:read` (no `security.*` event is sent yet). Events the token may not read are left out of the\nlist, and answer `404` when asked for by ID.\n",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Only events of this type, such as `customer.live`. One type per call. A type that does not exist answers `422`.",
                        "schema": {
                            "type": "string",
                            "maxLength": 80,
                            "example": "customer.live"
                        }
                    },
                    {
                        "name": "customer",
                        "in": "query",
                        "description": "Only events about this customer: its ID, or `external_ref:` followed by your own reference.",
                        "schema": {
                            "type": "string",
                            "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                        }
                    },
                    {
                        "name": "created_after",
                        "in": "query",
                        "description": "Only events that happened after this time.",
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2026-11-14T08:00:00Z"
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "description": "Only events that came after the event with this ID, oldest first unless `order` says otherwise. `404` when the event is unknown or older than 90 days: use `created_after` then.",
                        "schema": {
                            "type": "string",
                            "example": "evt_01jcz8wg4h7v3y6n9q2k5m8p1r"
                        }
                    },
                    {
                        "name": "order",
                        "in": "query",
                        "description": "`desc` newest first, `asc` oldest first. Defaults to `desc`, or to `asc` when `after` is sent.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "asc",
                                "desc"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of events.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/EventList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: the event named in `after` is unknown or older than 90 days, or there is no customer as named in `customer`."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/events/{event}": {
            "get": {
                "tags": [
                    "Events"
                ],
                "operationId": "getEvent",
                "summary": "Get an event",
                "description": "One event by its `id`, the one in the webhook body and the `Monotree-Event-Id` header. An event the token may not read (see List events) answers `404`.",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "required": true,
                        "description": "The event's ID.",
                        "schema": {
                            "type": "string",
                            "example": "evt_01jcz8wg4h7v3y6n9q2k5m8p1r"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The event.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Event"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such event, or it is older than 90 days."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}/statistics": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "get": {
                "tags": [
                    "Statistics"
                ],
                "operationId": "getCustomerStatistics",
                "summary": "Get a customer's statistics",
                "description": "How one customer uses Monotree over a period, from the numbers Monotree counts once a night. `totals` are the latest day in the range, `period` and `daily` cover the range. A customer with no numbers in the range (not live yet, or live since today) answers zeros, an empty `daily` and `updated_at: null`. See [Statistics and adoption](/docs/statistics).",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "range",
                        "in": "query",
                        "description": "The period: the last 7, 30 or 90 days, today included.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "7d",
                                "30d",
                                "90d"
                            ],
                            "default": "30d"
                        },
                        "example": "7d"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The customer's numbers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Statistics"
                                },
                                "example": {
                                    "object": "statistics",
                                    "customer": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                                    "range": "7d",
                                    "updated_at": "2026-11-14",
                                    "totals": {
                                        "users": 8,
                                        "invited": 9,
                                        "active_users_7d": 7,
                                        "activation_rate": 89,
                                        "weekly_active_rate": 88,
                                        "devices": {
                                            "ios": 4,
                                            "android": 3
                                        },
                                        "push_enabled_rate": 86
                                    },
                                    "period": {
                                        "posts": 3,
                                        "comments": 9,
                                        "reactions": 27,
                                        "messages": 48,
                                        "user_growth": 0
                                    },
                                    "languages": {
                                        "fr": 7,
                                        "en": 1
                                    },
                                    "daily": [
                                        {
                                            "date": "2026-11-13",
                                            "users": 8,
                                            "active_users": 4,
                                            "posts": 1,
                                            "comments": 2,
                                            "reactions": 5,
                                            "messages": 9
                                        },
                                        {
                                            "date": "2026-11-14",
                                            "users": 8,
                                            "active_users": 2,
                                            "posts": 0,
                                            "comments": 1,
                                            "reactions": 3,
                                            "messages": 4
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `range` is not `7d`, `30d` or `90d`."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/customers/{customer}/insights": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/CustomerId"
                }
            ],
            "get": {
                "tags": [
                    "Statistics"
                ],
                "operationId": "getCustomerInsights",
                "summary": "Get a customer's insights",
                "description": "What the numbers mean for one customer, as the Statistics tab of the portal shows it: a verdict with the next thing to do, how far the rollout has come, the customer beside the average of your other live customers, and its weekly active rate day by day. The texts are English and may be reworded; build on the `key`s. A customer that was never live answers `409`. See [Statistics and adoption](/docs/statistics).",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "range",
                        "in": "query",
                        "description": "The period: the last 7, 30 or 90 days, today included.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "7d",
                                "30d",
                                "90d"
                            ],
                            "default": "30d"
                        },
                        "example": "7d"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The customer's insights.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Insights"
                                },
                                "example": {
                                    "object": "insights",
                                    "customer": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                                    "range": "7d",
                                    "live_days": 128,
                                    "verdict": {
                                        "key": "doing_well",
                                        "title": "Doing well",
                                        "text": "88% of its users came this week, more than your customers on average (64%).",
                                        "next_step": "A good customer to ask for a quote or a reference."
                                    },
                                    "funnel": [
                                        {
                                            "key": "employees",
                                            "label": "Employees",
                                            "value": 9
                                        },
                                        {
                                            "key": "invited",
                                            "label": "Invited",
                                            "value": 9
                                        },
                                        {
                                            "key": "signed_in",
                                            "label": "Signed in",
                                            "value": 8
                                        },
                                        {
                                            "key": "active_this_week",
                                            "label": "Active this week",
                                            "value": 7
                                        }
                                    ],
                                    "comparison": [
                                        {
                                            "key": "activation_rate",
                                            "label": "Signed in",
                                            "value": 89,
                                            "average": 76,
                                            "unit": "percent"
                                        },
                                        {
                                            "key": "weekly_active_rate",
                                            "label": "Active this week",
                                            "value": 88,
                                            "average": 64,
                                            "unit": "percent"
                                        },
                                        {
                                            "key": "activity_per_active_user",
                                            "label": "Activity per active user",
                                            "value": 12.4,
                                            "average": 10.7,
                                            "unit": "per_week"
                                        },
                                        {
                                            "key": "push_enabled_rate",
                                            "label": "Push notifications on",
                                            "value": 86,
                                            "average": 80,
                                            "unit": "percent"
                                        }
                                    ],
                                    "activity": {
                                        "now": 87,
                                        "before": 92,
                                        "change": -5
                                    },
                                    "weekly_active_rate": [
                                        {
                                            "date": "2026-11-13",
                                            "rate": 88,
                                            "average": 65
                                        },
                                        {
                                            "date": "2026-11-14",
                                            "rate": 88,
                                            "average": 65
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the customer was never live, so there is nothing to say yet."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `range` is not `7d`, `30d` or `90d`."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/statistics": {
            "get": {
                "tags": [
                    "Statistics"
                ],
                "operationId": "getStatistics",
                "summary": "Get the statistics of all customers",
                "description": "How all your live customers use Monotree together over a period, in the shape of [a customer's statistics](#get-customer-statistics), and each live customer beside the others in `customers_ranked`, the best taken up first. Only customers with the status `live` are counted. The numbers of the Statistics page in the portal. A sandbox token gets the sandbox's customers.",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "range",
                        "in": "query",
                        "description": "The period: the last 7, 30 or 90 days, today included.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "7d",
                                "30d",
                                "90d"
                            ],
                            "default": "30d"
                        },
                        "example": "7d"
                    },
                    {
                        "$ref": "#/components/parameters/SellerFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The numbers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PartnerStatistics"
                                },
                                "example": {
                                    "object": "partner_statistics",
                                    "range": "7d",
                                    "updated_at": "2026-11-14",
                                    "customers": 43,
                                    "employees": 949,
                                    "totals": {
                                        "users": 724,
                                        "invited": 947,
                                        "active_users_7d": 468,
                                        "activation_rate": 76,
                                        "weekly_active_rate": 65,
                                        "devices": {
                                            "ios": 392,
                                            "android": 274
                                        },
                                        "push_enabled_rate": 80
                                    },
                                    "period": {
                                        "posts": 147,
                                        "comments": 390,
                                        "reactions": 1450,
                                        "messages": 3019,
                                        "user_growth": 3.9
                                    },
                                    "languages": {
                                        "fr": 425,
                                        "es": 112,
                                        "en": 88,
                                        "it": 67,
                                        "nl": 17,
                                        "de": 15
                                    },
                                    "daily": [
                                        {
                                            "date": "2026-11-13",
                                            "users": 722,
                                            "active_users": 296,
                                            "posts": 23,
                                            "comments": 64,
                                            "reactions": 232,
                                            "messages": 506
                                        },
                                        {
                                            "date": "2026-11-14",
                                            "users": 724,
                                            "active_users": 160,
                                            "posts": 13,
                                            "comments": 29,
                                            "reactions": 128,
                                            "messages": 252
                                        }
                                    ],
                                    "customers_ranked": [
                                        {
                                            "customer": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                                            "company_name": "Boulangerie Martin",
                                            "company_id": "boulangeriemartin",
                                            "external_ref": "org_48213",
                                            "seller": {
                                                "id": "sel_12",
                                                "name": "Emma Dubois",
                                                "external_ref": "usr_20503"
                                            },
                                            "employees": 9,
                                            "users": 8,
                                            "activation_rate": 89,
                                            "weekly_active_rate": 88,
                                            "weekly_active_change": 0,
                                            "activity": 87,
                                            "adoption": null
                                        },
                                        {
                                            "customer": "cus_01jd0b2q4m6s8u0w2y4a6c8e0g",
                                            "company_name": "Librairie Voltaire",
                                            "company_id": "librairievoltaire",
                                            "external_ref": "org_51877",
                                            "seller": {
                                                "id": "sel_12",
                                                "name": "Emma Dubois",
                                                "external_ref": "usr_20503"
                                            },
                                            "employees": 21,
                                            "users": 4,
                                            "activation_rate": 19,
                                            "weekly_active_rate": 75,
                                            "weekly_active_change": 0,
                                            "activity": 34,
                                            "adoption": {
                                                "alert": "ala_01jd3m5p7r9t1v3x5z7b9d1f3h",
                                                "reason": "activation",
                                                "message": "Only 19% of invited employees have signed in, 126 days after going live"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no seller matches `seller`."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `range` is not `7d`, `30d` or `90d`, or a seller filter is too long."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/summary": {
            "get": {
                "tags": [
                    "Statistics"
                ],
                "operationId": "getSummary",
                "summary": "Get the headline numbers",
                "description": "Where you stand right now: how many customers are in each state, how the live ones use the app, how many of them have an open adoption alert, and the customers signed in each of the last six months. The numbers on top of the Customers page in the portal. It takes no parameters.",
                "x-ability": "customers:read",
                "responses": {
                    "200": {
                        "description": "The numbers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Summary"
                                },
                                "example": {
                                    "object": "summary",
                                    "counts": {
                                        "draft": 1,
                                        "provisioning": 0,
                                        "live": 43,
                                        "failed": 1,
                                        "suspended": 2,
                                        "cancelled": 3
                                    },
                                    "live_customers": 43,
                                    "employees": 949,
                                    "users": 724,
                                    "activation_rate": 76,
                                    "weekly_active_rate": 65,
                                    "low_adoption": 4,
                                    "signed_by_month": [
                                        {
                                            "month": "2026-06",
                                            "signed": 6
                                        },
                                        {
                                            "month": "2026-07",
                                            "signed": 7
                                        },
                                        {
                                            "month": "2026-08",
                                            "signed": 6
                                        },
                                        {
                                            "month": "2026-09",
                                            "signed": 5
                                        },
                                        {
                                            "month": "2026-10",
                                            "signed": 5
                                        },
                                        {
                                            "month": "2026-11",
                                            "signed": 7
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/adoption-alerts": {
            "get": {
                "tags": [
                    "Adoption"
                ],
                "operationId": "listAdoptionAlerts",
                "summary": "List adoption alerts",
                "description": "An adoption alert says that a live customer stalls: few of the invited employees signed in, activity dropped, or its numbers stopped coming. Monotree checks every morning at 05:00 UTC; a customer has one open alert at most, and the alert is resolved when the customer recovers or is no longer live. Only the open alerts unless `status` says otherwise. The alert made last comes first. See [Statistics and adoption](/docs/statistics).",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Open alerts, resolved ones, or all.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "resolved",
                                "all"
                            ],
                            "default": "open"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/SellerFilter"
                    },
                    {
                        "name": "customer",
                        "in": "query",
                        "description": "Only the alerts of this customer, by ID or by `external_ref:` followed by your own reference. An unknown customer answers `404`.",
                        "schema": {
                            "type": "string",
                            "maxLength": 160,
                            "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                        }
                    },
                    {
                        "name": "reason",
                        "in": "query",
                        "description": "Only alerts with this reason.",
                        "schema": {
                            "$ref": "#/components/schemas/AdoptionReason"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of alerts.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AdoptionAlertList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "ala_01jd3m5p7r9t1v3x5z7b9d1f3h",
                                            "object": "adoption_alert",
                                            "customer": {
                                                "id": "cus_01jd0b2q4m6s8u0w2y4a6c8e0g",
                                                "company_name": "Librairie Voltaire",
                                                "external_ref": "org_51877"
                                            },
                                            "reason": "activation",
                                            "message": "Only 19% of invited employees have signed in, 126 days after going live",
                                            "advice": "Ask Louis Arnaud to invite the team again, or to share the company ID librairievoltaire at the next staff meeting.",
                                            "flagged_at": "2026-11-14T05:00:04Z",
                                            "resolved_at": null
                                        }
                                    ],
                                    "has_more": false,
                                    "next_cursor": null
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no customer matches `customer`, or no seller matches `seller`."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `status`, `reason` or `limit` has a value that is not allowed."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/adoption-alerts/{alert}": {
            "parameters": [
                {
                    "name": "alert",
                    "in": "path",
                    "required": true,
                    "description": "The alert's ID.",
                    "schema": {
                        "type": "string",
                        "example": "ala_01jd3m5p7r9t1v3x5z7b9d1f3h"
                    }
                }
            ],
            "get": {
                "tags": [
                    "Adoption"
                ],
                "operationId": "getAdoptionAlert",
                "summary": "Get an adoption alert",
                "description": "One alert, open or resolved. While it is open, its `reason` and `message` follow the latest numbers.",
                "x-ability": "customers:read",
                "responses": {
                    "200": {
                        "description": "The alert.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AdoptionAlert"
                                },
                                "example": {
                                    "id": "ala_01jd3m5p7r9t1v3x5z7b9d1f3h",
                                    "object": "adoption_alert",
                                    "customer": {
                                        "id": "cus_01jd0b2q4m6s8u0w2y4a6c8e0g",
                                        "company_name": "Librairie Voltaire",
                                        "external_ref": "org_51877"
                                    },
                                    "reason": "activation",
                                    "message": "Only 19% of invited employees have signed in, 126 days after going live",
                                    "advice": "Ask Louis Arnaud to invite the team again, or to share the company ID librairievoltaire at the next staff meeting.",
                                    "flagged_at": "2026-11-14T05:00:04Z",
                                    "resolved_at": null
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such adoption alert for your company and mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/overview": {
            "get": {
                "tags": [
                    "Statement"
                ],
                "operationId": "getOverview",
                "summary": "Get a month",
                "description": "Your customers in one month as Monotree counts them for the monthly statement: the customers live on the last day of the month, per seller and per customer. Months run on UTC. With `format=csv` (or the header `Accept: text/csv`) the customers come as a CSV file, the same one the portal exports. See [The monthly statement](/docs/statement).",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "name": "month",
                        "in": "query",
                        "description": "The month, `YYYY-MM`. This month when left out. A month in the future, or before your first month with Monotree, answers `422`.",
                        "schema": {
                            "type": "string",
                            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
                            "example": "2026-10"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "`csv` for a spreadsheet of the customers instead of JSON. When left out, the header `Accept: text/csv` asks for the same.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "json",
                                "csv"
                            ],
                            "default": "json"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/SellerFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The month. As CSV, a file named `monotree-YYYY-MM.csv` with one row for each customer in `customers`: UTF-8 (`text/csv; charset=utf-8`), starting with a byte order mark so that Excel reads it as such.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Overview"
                                },
                                "example": {
                                    "object": "overview",
                                    "month": "2026-10",
                                    "complete": true,
                                    "live_customers": 39,
                                    "employees": 894,
                                    "users": 702,
                                    "signed": 5,
                                    "cancelled": 2,
                                    "sellers": [
                                        {
                                            "seller": {
                                                "id": "sel_12",
                                                "name": "Emma Dubois",
                                                "external_ref": "usr_20503"
                                            },
                                            "customers": 10,
                                            "employees": 254,
                                            "users": 208,
                                            "signed": 1
                                        }
                                    ],
                                    "customers": [
                                        {
                                            "id": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                                            "company_name": "Boulangerie Martin",
                                            "company_id": "boulangeriemartin",
                                            "external_ref": "org_48213",
                                            "seller": {
                                                "id": "sel_12",
                                                "name": "Emma Dubois",
                                                "external_ref": "usr_20503"
                                            },
                                            "live_at": "2026-07-09",
                                            "employees": 9,
                                            "users": 8
                                        }
                                    ]
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                },
                                "example": "\"Customer ID\",Company,\"Company ID\",\"External ref\",Seller,\"Live since\",Employees,\"Monotree users\"\ncus_01jcz8w3k1x9q2v7s4e6m0b5n8,\"Boulangerie Martin\",boulangeriemartin,org_48213,\"Emma Dubois\",2026-07-09,9,8\ncus_01jd0b2q4m6s8u0w2y4a6c8e0g,\"Librairie Voltaire\",librairievoltaire,org_51877,\"Emma Dubois\",2026-07-11,21,4\n"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no seller matches `seller`."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `month` is not written `YYYY-MM`, lies in the future or before your first month with Monotree, or `format` is not `json` or `csv`. `fields` names the parameter."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/overview/months": {
            "get": {
                "tags": [
                    "Statement"
                ],
                "operationId": "listOverviewMonths",
                "summary": "List the last 12 months",
                "description": "The last twelve months, oldest first and this month last: the customers live at the end of each month (right now, for the month that runs) and the customers signed in it. Up to twelve rows: only months [Get a month](#get-overview) answers for, so the list starts at your first month with Monotree when that is less than a year ago. Never paged: the usual list shape, with `has_more` always `false`. `live_customers` of a month is the same number as in [Get a month](#get-overview).",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SellerFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The months.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OverviewMonthList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "month": "2025-12",
                                            "live_customers": 0,
                                            "signed": 0
                                        },
                                        {
                                            "month": "2026-01",
                                            "live_customers": 0,
                                            "signed": 0
                                        },
                                        {
                                            "month": "2026-02",
                                            "live_customers": 0,
                                            "signed": 0
                                        },
                                        {
                                            "month": "2026-03",
                                            "live_customers": 1,
                                            "signed": 1
                                        },
                                        {
                                            "month": "2026-04",
                                            "live_customers": 5,
                                            "signed": 4
                                        },
                                        {
                                            "month": "2026-05",
                                            "live_customers": 13,
                                            "signed": 8
                                        },
                                        {
                                            "month": "2026-06",
                                            "live_customers": 19,
                                            "signed": 6
                                        },
                                        {
                                            "month": "2026-07",
                                            "live_customers": 26,
                                            "signed": 7
                                        },
                                        {
                                            "month": "2026-08",
                                            "live_customers": 32,
                                            "signed": 6
                                        },
                                        {
                                            "month": "2026-09",
                                            "live_customers": 37,
                                            "signed": 5
                                        },
                                        {
                                            "month": "2026-10",
                                            "live_customers": 39,
                                            "signed": 5
                                        },
                                        {
                                            "month": "2026-11",
                                            "live_customers": 43,
                                            "signed": 7
                                        }
                                    ],
                                    "has_more": false,
                                    "next_cursor": null
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no seller matches `seller`."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a seller filter is too long."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/sellers": {
            "get": {
                "tags": [
                    "Sellers"
                ],
                "operationId": "listSellers",
                "summary": "List sellers",
                "description": "Everyone at your company, admins and sellers, with what each brought in. Newest first by when they were added; lists cannot be sorted another way. A sandbox token lists test sellers only and a live token never lists them. See [Sellers and attribution](/docs/sellers).",
                "x-ability": "customers:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "role",
                        "in": "query",
                        "description": "Only admins, or only sellers.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "admin",
                                "seller"
                            ],
                            "example": "seller"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only people in this status. `active`, `invited` and `api_only` leave disabled people out.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "active",
                                "invited",
                                "api_only",
                                "disabled"
                            ],
                            "example": "invited"
                        }
                    },
                    {
                        "name": "disabled",
                        "in": "query",
                        "description": "`true` for disabled people only, `false` to leave them out. `1` and `0` are read the same way.",
                        "schema": {
                            "type": "boolean",
                            "example": false
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "description": "People whose name, email address or reference contains this text.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120,
                            "example": "emma"
                        }
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "description": "Only the person with exactly this email address. Capitals do not matter.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120,
                            "example": "emma@acme.example"
                        }
                    },
                    {
                        "name": "external_ref",
                        "in": "query",
                        "description": "Only the person with exactly this reference of yours.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120,
                            "example": "usr_20503"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only people whose `updated_at` is at or after this time, to keep a copy in step. `updated_at` also moves when the person signs in.",
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2026-11-01T00:00:00Z"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of sellers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SellerList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "sel_9",
                                            "object": "seller",
                                            "name": "In\u00e8s Roux",
                                            "email": "ines@acme.example",
                                            "role": "seller",
                                            "external_ref": "usr_20777",
                                            "status": "invited",
                                            "can_login": true,
                                            "disabled": false,
                                            "two_factor": false,
                                            "passkeys": 0,
                                            "adoption_digest": true,
                                            "live_customers": 0,
                                            "employees": 0,
                                            "signed_this_month": 0,
                                            "invited_at": "2026-11-10T13:28:07Z",
                                            "last_login_at": null,
                                            "created_at": "2026-11-10T13:28:07Z",
                                            "updated_at": "2026-11-10T13:28:07Z"
                                        },
                                        {
                                            "id": "sel_5",
                                            "object": "seller",
                                            "name": "Emma Dubois",
                                            "email": "emma@acme.example",
                                            "role": "seller",
                                            "external_ref": "usr_20503",
                                            "status": "active",
                                            "can_login": true,
                                            "disabled": false,
                                            "two_factor": true,
                                            "passkeys": 0,
                                            "adoption_digest": true,
                                            "live_customers": 11,
                                            "employees": 261,
                                            "signed_this_month": 1,
                                            "invited_at": "2026-03-12T13:28:06Z",
                                            "last_login_at": "2026-11-14T12:41:59Z",
                                            "created_at": "2026-03-12T13:28:06Z",
                                            "updated_at": "2026-11-14T12:41:59Z"
                                        }
                                    ],
                                    "has_more": true,
                                    "next_cursor": "6Yb0mT9wQ3F7ImlkIjo1fQ"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a filter has a value that is not allowed, or `limit` is not 1 to 100."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Sellers"
                ],
                "operationId": "createSeller",
                "summary": "Add a seller",
                "description": "Adds a person and, unless `invite` is false, emails them an invitation to the portal. You never need this call to credit customers to someone: `seller_ref` on a new customer adds a seller without a login by itself. Adding an admin (`role: admin`) also needs the `admins:write` ability. An email address that is in use anywhere else answers `422` with one sentence that does not say where: the answer never tells whose an address is, and calls with `invite: false` are limited to 60 an hour. With a sandbox token a test seller is made: nobody is invited or emailed whatever `invite` says, and the answer has `status: api_only`.",
                "x-ability": "sellers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SellerCreate"
                            },
                            "example": {
                                "name": "In\u00e8s Roux",
                                "email": "ines@acme.example",
                                "external_ref": "usr_20777"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The seller: `invited`, or `api_only` when `invite` is false or the token is a sandbox one.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Seller"
                                },
                                "example": {
                                    "id": "sel_9",
                                    "object": "seller",
                                    "name": "In\u00e8s Roux",
                                    "email": "ines@acme.example",
                                    "role": "seller",
                                    "external_ref": "usr_20777",
                                    "status": "invited",
                                    "can_login": true,
                                    "disabled": false,
                                    "two_factor": false,
                                    "passkeys": 0,
                                    "adoption_digest": true,
                                    "live_customers": 0,
                                    "employees": 0,
                                    "signed_this_month": 0,
                                    "invited_at": "2026-11-10T13:28:07Z",
                                    "last_login_at": null,
                                    "created_at": "2026-11-10T13:28:07Z",
                                    "updated_at": "2026-11-10T13:28:07Z"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`validation_error`: a field is missing or invalid, or the email address or reference is taken.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "error": {
                                        "type": "validation_error",
                                        "message": "Some fields are missing or invalid.",
                                        "fields": {
                                            "email": [
                                                "One of your sellers already has this email address."
                                            ],
                                            "external_ref": [
                                                "The external ref has already been taken."
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`insufficient_ability`: the token lacks `sellers:write`, or `admins:write` when `role` is `admin`."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 30 sellers invited in an hour, or more than 60 added with `invite: false` in an hour (each counted for all your tokens of one mode together), or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/sellers/{seller}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SellerId"
                }
            ],
            "get": {
                "tags": [
                    "Sellers"
                ],
                "operationId": "getSeller",
                "summary": "Get a seller",
                "description": "One person, by Monotree's ID (`sel_5`) or by your own reference (`external_ref:usr_20503`). A person of the other mode answers `404`.",
                "x-ability": "customers:read",
                "responses": {
                    "200": {
                        "description": "The seller.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Seller"
                                },
                                "example": {
                                    "id": "sel_5",
                                    "object": "seller",
                                    "name": "Emma Dubois",
                                    "email": "emma@acme.example",
                                    "role": "seller",
                                    "external_ref": "usr_20503",
                                    "status": "active",
                                    "can_login": true,
                                    "disabled": false,
                                    "two_factor": true,
                                    "passkeys": 0,
                                    "adoption_digest": true,
                                    "live_customers": 11,
                                    "employees": 261,
                                    "signed_this_month": 1,
                                    "invited_at": "2026-03-12T13:28:06Z",
                                    "last_login_at": "2026-11-14T12:41:59Z",
                                    "created_at": "2026-03-12T13:28:06Z",
                                    "updated_at": "2026-11-14T12:41:59Z"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such seller in the mode of the token."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Sellers"
                ],
                "operationId": "updateSeller",
                "summary": "Change a seller",
                "description": "Changes only the fields you send: the name, email address, reference or role, `invite` to the portal, the Monday email, or `disabled`. A disabled person is signed out at once and cannot sign in; their customers stay as they are. Making someone an admin, and changing an admin's email address, role or `disabled` or inviting an admin, also needs the `admins:write` ability. So does changing the email address of anyone who has chosen a password (`status: active`), admin or seller: it is what they sign in with; of anyone who is invited (the invitation would follow the address); and of a seller who has customers. And so does `invite: true` for a seller who has customers and was never invited: whoever accepts sees those customers. With `sellers:write` alone a token gives an address to, and invites, a seller who has no customers yet. A call with `email` counts against the invitation limit of that seller (3 an hour) and 30 address changes an hour for all your sellers. When the address of someone who signs in changes, the old address gets an email saying so, the person is signed out everywhere and any password-reset link they asked for stops working. The last admin who can sign in cannot be disabled or made a seller (`409 last_admin`).",
                "x-ability": "sellers:write",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SellerUpdate"
                            },
                            "example": {
                                "disabled": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The seller after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Seller"
                                },
                                "example": {
                                    "id": "sel_9",
                                    "object": "seller",
                                    "name": "In\u00e8s Roux",
                                    "email": "ines@acme.example",
                                    "role": "seller",
                                    "external_ref": "usr_20777",
                                    "status": "disabled",
                                    "can_login": true,
                                    "disabled": true,
                                    "two_factor": false,
                                    "passkeys": 0,
                                    "adoption_digest": true,
                                    "live_customers": 0,
                                    "employees": 0,
                                    "signed_this_month": 0,
                                    "invited_at": "2026-11-10T13:28:07Z",
                                    "last_login_at": null,
                                    "created_at": "2026-11-10T13:28:07Z",
                                    "updated_at": "2026-11-14T12:43:48Z"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`last_admin`: this is the only admin who can sign in, so they cannot be disabled or made a seller. `seller_disabled`: `invite` was sent for a disabled seller. `already_active`: `invite` was sent for someone who has a password already.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "error": {
                                        "type": "last_admin",
                                        "message": "This is the only admin who can sign in. Make someone else an admin first, or nobody could manage your company in the portal."
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`insufficient_ability`: the token lacks `sellers:write`, or `admins:write` when the change makes someone an admin, changes an admin's email address, role or `disabled`, invites an admin, changes the email address of anyone who has chosen a password, or changes the `external_ref` of a seller who has customers, signs in or is invited."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such seller in the mode of the token."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is invalid, an email address or reference is taken, or `invite` was sent for a seller without an email address."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 3 invitations in an hour for this seller (only calls with `invite: true` are counted), or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/sellers/{seller}/invite": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SellerId"
                }
            ],
            "post": {
                "tags": [
                    "Sellers"
                ],
                "operationId": "inviteSeller",
                "summary": "Invite a seller",
                "description": "Emails the seller an invitation to the portal, or sends it again; the link in an earlier invitation stops working. The seller needs an email address (`422` otherwise) and takes no request body. Inviting an admin also needs `admins:write`, and so does a first invitation to a seller who already has customers (one known from `seller_ref`, say): whoever accepts it sees those customers in the portal. Sending an invitation again to the address it went to needs `sellers:write` alone. With a sandbox token nothing is sent and the seller is returned unchanged.",
                "x-ability": "sellers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The seller, with `status: invited` and a new `invited_at`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Seller"
                                },
                                "example": {
                                    "id": "sel_9",
                                    "object": "seller",
                                    "name": "In\u00e8s Roux",
                                    "email": "ines@acme.example",
                                    "role": "seller",
                                    "external_ref": "usr_20777",
                                    "status": "invited",
                                    "can_login": true,
                                    "disabled": false,
                                    "two_factor": false,
                                    "passkeys": 0,
                                    "adoption_digest": true,
                                    "live_customers": 0,
                                    "employees": 0,
                                    "signed_this_month": 0,
                                    "invited_at": "2026-11-14T12:43:48Z",
                                    "last_login_at": null,
                                    "created_at": "2026-11-10T13:28:07Z",
                                    "updated_at": "2026-11-14T12:43:48Z"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`already_active`: the seller has chosen a password and can sign in. `seller_disabled`: a disabled seller cannot be invited.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "error": {
                                        "type": "already_active",
                                        "message": "This seller has chosen a password already and can sign in."
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`validation_error` on `invite`: the seller has no email address.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "error": {
                                        "type": "validation_error",
                                        "message": "Some fields are missing or invalid.",
                                        "fields": {
                                            "invite": [
                                                "This seller has no email address. Give them one first, then invite them."
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`insufficient_ability`: the token lacks `sellers:write`, or `admins:write` when the seller is an admin."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such seller in the mode of the token."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 3 invitations in an hour for this seller, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/sellers/{seller}/reset-two-factor": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SellerId"
                }
            ],
            "post": {
                "tags": [
                    "Sellers"
                ],
                "operationId": "resetSellerTwoFactor",
                "summary": "Reset two-factor sign-in",
                "description": "For a person who lost their phone and their recovery codes. Turns their two-factor sign-in off, removes their passkeys and signs them out everywhere; they set two-factor sign-in up again the next time they sign in with their password, and get an email saying it was done through the API with the name of your token. Resetting an admin, or anyone who has chosen a password (`status: active`), also needs `admins:write`; in practice that is everyone with something to reset. A seller with nothing to reset is returned unchanged and gets no email. It takes no request body. See [Security and sign-in](/docs/security).",
                "x-ability": "sellers:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The seller, with `two_factor` false and `passkeys` 0.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Seller"
                                },
                                "example": {
                                    "id": "sel_5",
                                    "object": "seller",
                                    "name": "Emma Dubois",
                                    "email": "emma@acme.example",
                                    "role": "seller",
                                    "external_ref": "usr_20503",
                                    "status": "active",
                                    "can_login": true,
                                    "disabled": false,
                                    "two_factor": false,
                                    "passkeys": 0,
                                    "adoption_digest": true,
                                    "live_customers": 11,
                                    "employees": 261,
                                    "signed_this_month": 1,
                                    "invited_at": "2026-03-12T13:28:06Z",
                                    "last_login_at": "2026-11-14T12:41:59Z",
                                    "created_at": "2026-03-12T13:28:06Z",
                                    "updated_at": "2026-11-14T12:43:36Z"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`insufficient_ability`: the token lacks `sellers:write`, or `admins:write` when the seller is an admin or has chosen a password."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such seller in the mode of the token."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 5 resets in an hour for this seller, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/security/people": {
            "get": {
                "tags": [
                    "Security"
                ],
                "operationId": "listSecurityPeople",
                "summary": "List who can sign in",
                "description": "Your people who have a password and are not disabled, each with their two-factor sign-in, passkeys, last sign-in and wrong tries. Newest first by when they were added. Test sellers never sign in, so a sandbox token gets an empty list. See [Security and sign-in](/docs/security).",
                "x-ability": "security:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of people.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SecurityPersonList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "object": "security_person",
                                            "seller": {
                                                "id": "sel_5",
                                                "name": "Emma Dubois",
                                                "email": "emma@acme.example",
                                                "external_ref": "usr_20503",
                                                "role": "seller"
                                            },
                                            "two_factor": true,
                                            "passkeys": 0,
                                            "last_sign_in": {
                                                "at": "2026-11-14T12:41:59Z",
                                                "device": "Chrome on macOS",
                                                "ip": "203.0.113.7",
                                                "via": "password"
                                            },
                                            "failed_7d": 0,
                                            "dormant": false
                                        }
                                    ],
                                    "has_more": true,
                                    "next_cursor": "6Yb0mT9wQ3F7ImlkIjo1fQ"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `limit` is not 1 to 100."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/security/events": {
            "get": {
                "tags": [
                    "Security"
                ],
                "operationId": "listSecurityEvents",
                "summary": "List the sign-in log",
                "description": "Sign-ins, sign-outs, wrong tries and changes to how someone signs in, newest first. Kept 180 days. These are not the [events](/docs/reference/events) your webhook endpoints get: the sign-in log is only read here. A sandbox token gets an empty list.",
                "x-ability": "security:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "show",
                        "in": "query",
                        "description": "`denied` for attempts that did not get in (`login.failed`, `login.lockout`, `two_factor.failed`), `changes` for changes to how someone signs in (`password.reset`, `password.changed`, `two_factor.confirmed`, `two_factor.disabled`, `two_factor.reset`, `two_factor.recovery_code_used`, `two_factor.recovery_codes_generated`, `passkey.added`, `passkey.removed`).",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "all",
                                "denied",
                                "changes"
                            ],
                            "default": "all",
                            "example": "denied"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/SellerFilter"
                    },
                    {
                        "name": "created_after",
                        "in": "query",
                        "description": "Only lines later than this time, to fetch only what is new.",
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2026-11-14T12:00:00Z"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of the sign-in log.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SecurityEventList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "sev_83",
                                            "object": "security_event",
                                            "type": "two_factor.confirmed",
                                            "label": "Two-factor sign-in turned on",
                                            "denied": false,
                                            "seller": {
                                                "id": "sel_5",
                                                "name": "Emma Dubois",
                                                "external_ref": "usr_20503"
                                            },
                                            "device": "Chrome on macOS",
                                            "ip": "203.0.113.7",
                                            "created_at": "2026-11-14T12:43:36Z"
                                        },
                                        {
                                            "id": "sev_82",
                                            "object": "security_event",
                                            "type": "login",
                                            "label": "Signed in",
                                            "denied": false,
                                            "seller": {
                                                "id": "sel_5",
                                                "name": "Emma Dubois",
                                                "external_ref": "usr_20503"
                                            },
                                            "device": "Chrome on macOS",
                                            "ip": "203.0.113.7",
                                            "created_at": "2026-11-14T12:41:59Z"
                                        }
                                    ],
                                    "has_more": true,
                                    "next_cursor": "Kq2xV8dLm1N7ImlkIjo4Mn0"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: `seller` names nobody in the mode of the token."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `show` is not one of its values, `after` is not a time, or `limit` is not 1 to 100."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/stats": {
            "get": {
                "tags": [
                    "Support desk"
                ],
                "operationId": "getSupportStats",
                "summary": "Get support stats",
                "description": "The numbers of your support desk over a period, as the Stats tab in the portal shows them: new and solved threads, first-answer and solving times, topics, ratings, what became of the assistant's drafts, and what went to Monotree. Every number has a name that stays; labels are in English. A share is a whole percentage, or null where there is nothing to take a share of. A thread you started yourself counts once the customer has written in it; threads dismissed by the desk itself are left out.",
                "x-ability": "support:read",
                "parameters": [
                    {
                        "name": "days",
                        "in": "query",
                        "description": "The period: `1` today, `-1` yesterday, `7`, `30` or `90` days up to and including today, `0` all time.",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                1,
                                -1,
                                7,
                                30,
                                90,
                                0
                            ],
                            "default": 30,
                            "example": 7
                        }
                    },
                    {
                        "name": "customer",
                        "in": "query",
                        "description": "Only the numbers of this customer: its ID, or `external_ref:` and your own reference.",
                        "schema": {
                            "type": "string",
                            "maxLength": 140,
                            "example": "external_ref:org_48213"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The numbers.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportStats"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer for your company and mode."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `days` is not one of the six periods."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/tags": {
            "get": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "listSupportTags",
                "summary": "List support tags",
                "description": "The product areas of the Monotree app a thread can be tagged with, by name. The list is the same for every partner and you cannot add to it. The assistant tags a thread when it reads it; you can change a thread's tags. Every tag comes in one answer: there are no pages.",
                "x-ability": "support:read",
                "responses": {
                    "200": {
                        "description": "Every tag, by name.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportTagList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": 11,
                                            "object": "support_tag",
                                            "name": "App install",
                                            "color": "#1f2937"
                                        },
                                        {
                                            "id": 1,
                                            "object": "support_tag",
                                            "name": "Invitations",
                                            "color": "#0e7490"
                                        },
                                        {
                                            "id": 2,
                                            "object": "support_tag",
                                            "name": "Login",
                                            "color": "#b91c1c"
                                        }
                                    ],
                                    "has_more": false,
                                    "next_cursor": null
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/people": {
            "get": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "listSupportPeople",
                "summary": "List people you can write to",
                "description": "The people at your customers a thread can be [started](/docs/reference/support-threads#start-support-thread) with by chat: those who have a Support room in their Monotree app and have written to support in it before. Newest first, by when they first wrote. With `customer`, the admin Monotree invited at that customer comes first on the first page, flagged `admin: true`: they can always be written to by mail (`channel: email` and their `email`), also at a new customer where nobody has written yet; their `id` is null until there is a thread with them. Anyone else known by mail only is not listed. People of a customer that is cancelled, deleted or not live yet are not listed: there is no Monotree to write to them in.",
                "x-ability": "support:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "customer",
                        "in": "query",
                        "description": "Only the people of this customer: its ID, or `external_ref:` and your own reference.",
                        "schema": {
                            "type": "string",
                            "maxLength": 140,
                            "example": "external_ref:org_48213"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "description": "Part of a name or an email address.",
                        "schema": {
                            "type": "string",
                            "maxLength": 80,
                            "example": "sophie"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of people.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportPersonList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "per_132",
                                            "object": "support_person",
                                            "name": "Sophie Garnier",
                                            "email": "sophie@boulangeriemartin.example",
                                            "phone": null,
                                            "role": "Manager",
                                            "title": null,
                                            "locale": "fr",
                                            "timezone": null,
                                            "departments": [],
                                            "device": null,
                                            "last_active_on": null,
                                            "verified": true,
                                            "chat": true,
                                            "customer": {
                                                "id": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                                                "company_name": "Boulangerie Martin"
                                            }
                                        }
                                    ],
                                    "has_more": false,
                                    "next_cursor": null
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer for your company and mode."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/threads": {
            "get": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "listSupportThreads",
                "summary": "List support threads",
                "description": "Your customers' support threads without their messages, as the Support page lists them: the thread last written in comes first (by `last_message_at`). Without `view` you get every thread. The filters narrow together. A sandbox token lists the threads of sandbox customers only, and a live token never lists them. `next_cursor` holds the place of the last thread of the page, so a thread written in while you page moves to the top and is not met twice. To keep a copy in step, ask with `updated_since`, or listen to the [support events](/docs/support#events).",
                "x-ability": "support:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "view",
                        "in": "query",
                        "description": "Where the Support page shows a thread; `status` is the thread's own field. The two differ for a thread put aside: it keeps its `status` (`open` or `waiting`) but its view is `snoozed`. `open`: waits for you. `waiting`: waits for the customer. `snoozed`: open or waiting, put aside until later (those are not in `open` or `waiting`). `followup`: an escalation of the thread was released and nobody has followed up yet, whatever the thread's status. `closed`, `dismissed`.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "waiting",
                                "snoozed",
                                "followup",
                                "closed",
                                "dismissed"
                            ],
                            "example": "open"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only threads with this `status`. Unlike `view`, `open` and `waiting` include the threads put aside (snoozed). Sent together with `view`, both must hold.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "waiting",
                                "closed",
                                "dismissed"
                            ],
                            "example": "open"
                        }
                    },
                    {
                        "name": "channel",
                        "in": "query",
                        "description": "Where it came from: their Support room (`chat`) or mail (`email`).",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "chat",
                                "email"
                            ],
                            "example": "chat"
                        }
                    },
                    {
                        "name": "assignee",
                        "in": "query",
                        "description": "A seller's ID (`sel_5`, or `external_ref:` and your reference for them), `none` for threads nobody has, or `me` for those of the person who made the token.",
                        "schema": {
                            "type": "string",
                            "maxLength": 140,
                            "example": "sel_5"
                        }
                    },
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "What the thread is.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "question",
                                "bug",
                                "feature_request",
                                "other"
                            ],
                            "example": "bug"
                        }
                    },
                    {
                        "name": "priority",
                        "in": "query",
                        "description": "How pressing it is.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "urgent",
                                "high",
                                "normal",
                                "low"
                            ],
                            "example": "high"
                        }
                    },
                    {
                        "name": "tag",
                        "in": "query",
                        "description": "A tag, by its name (capitals do not matter) or its id.",
                        "schema": {
                            "type": "string",
                            "maxLength": 60,
                            "example": "Invitations"
                        }
                    },
                    {
                        "name": "customer",
                        "in": "query",
                        "description": "Only the threads of this customer: its ID, or `external_ref:` and your own reference.",
                        "schema": {
                            "type": "string",
                            "maxLength": 140,
                            "example": "external_ref:org_48213"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "description": "Text to find: in the subject, the summary, the preview (the latest words of the thread), the name or email of who wrote, and their company. Older messages are not searched.",
                        "schema": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 80,
                            "example": "invitation"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Only threads whose `updated_at` is at or after this time.",
                        "schema": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2026-11-14T00:00:00Z"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of threads, without their messages.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThreadList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "sth_01m7d1ajq9w7ak2vnnp8hfdwj8",
                                            "object": "support_thread",
                                            "channel": "chat",
                                            "status": "open",
                                            "view": "open",
                                            "priority": "high",
                                            "kind": "bug",
                                            "subject": null,
                                            "summary": null,
                                            "preview": "Bonjour, mon invitation ne marche pas.",
                                            "language": "fr",
                                            "unread": true,
                                            "customer": {
                                                "id": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                                                "company_name": "Boulangerie Martin",
                                                "external_ref": "org_48213"
                                            },
                                            "person": {
                                                "id": "per_132",
                                                "object": "support_person",
                                                "name": "Sophie Garnier",
                                                "email": "sophie@boulangeriemartin.example",
                                                "phone": null,
                                                "role": "Manager",
                                                "title": null,
                                                "locale": "fr",
                                                "timezone": null,
                                                "departments": [],
                                                "device": null,
                                                "last_active_on": null,
                                                "verified": true,
                                                "chat": true,
                                                "customer": null
                                            },
                                            "assignee": null,
                                            "tags": [],
                                            "cc": [],
                                            "signed": true,
                                            "needs_person": null,
                                            "no_reply_needed": false,
                                            "snoozed_until": null,
                                            "resolution": null,
                                            "dismissed_reason": null,
                                            "rating": null,
                                            "rated_at": null,
                                            "reopened_count": 0,
                                            "message_count": 2,
                                            "started_at": "2026-11-14T12:43:10Z",
                                            "waiting_since": "2026-11-14T12:43:10Z",
                                            "first_response_at": null,
                                            "last_message_at": "2026-11-14T12:43:10Z",
                                            "closed_at": null,
                                            "updated_at": "2026-11-14T12:43:11Z"
                                        }
                                    ],
                                    "has_more": true,
                                    "next_cursor": "t7Rz0aPq5WJ7ImF0IjoiMjAyNi0xMS0xNCAxMjo0MzoxMCIsImlkIjoyMjV9"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the cursor is not one this list gave out. `invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer (`customer`) or seller (`assignee`)."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a filter has a value that is not allowed, `q` is shorter than 2 characters, or `tag` names no tag."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "startSupportThread",
                "summary": "Start a support thread",
                "description": "Writes to someone before they wrote, as **Write to a customer** does in the portal. By `chat` to one of a customer's people (find them with [List people](/docs/reference/support-threads#list-support-people)): where that person has a chat thread that is open or waiting, your message goes into it, since it is the same room to them; otherwise a new thread starts. By `email` to an address, always as a new thread. A token can only write to someone it has a reason to know: someone at one of your customers who has written to you before, or the admin Monotree invited at one of your customers that is live or suspended, by the exact address it invited (the admin of the setup, of the last change of admin that was applied, or of the last invitation sent again; an address you changed a moment ago does not count yet, and a draft's never). Nobody else: not a colleague at the admin's mail domain. Any other address answers `409 invalid_state` and nothing is sent. Naming a `customer` narrows the check to that customer. A mail counts against the recipients that may be written to in an hour (1,000 per mode). A new thread waits for the customer (`waiting`) and has nobody assigned.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportThreadStart"
                            },
                            "example": {
                                "channel": "chat",
                                "customer": "external_ref:org_48213",
                                "person": "per_132",
                                "body": "Bonjour Sophie, tout va bien ?"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The thread whole, with your message in it. For a chat this can be a thread that was there already.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer, or no such person at that customer."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the person has no Support room to write to; or, for `email`, the address is not someone who has written before, nor the admin Monotree invited at one of your live or suspended customers (of the one named in `customer`, when sent). `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing for the channel (`customer` and `person` for chat, `email` for email), or a sandbox token sent an email without `customer`. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 30 threads started by email in an hour (all your tokens of one mode together; chat is not counted), more than 1,000 recipients of mails in an hour, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/support/threads/simulate": {
            "post": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "simulateSupportMessage",
                "summary": "Simulate a customer's message",
                "description": "Sandbox only. Plays a message as if someone at one of your sandbox customers wrote it, through the same door real messages come in by: it lands in that person's open or waiting thread, reopens one closed within `reopen_days`, or starts a new thread; the assistant drafts; the automatic reply goes out when your sandbox desk is offline; and `support.message.received` (and `support.thread.created` for a new thread) are sent to your sandbox endpoints. The same `name` and `email` again is the same person writing again. Nothing in the sandbox is ever delivered to anyone.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportSimulate"
                            },
                            "example": {
                                "customer": "external_ref:org_48213",
                                "channel": "chat",
                                "name": "Sophie Garnier",
                                "email": "sophie@boulangeriemartin.example",
                                "role": "Manager",
                                "body": "Bonjour, mon invitation ne marche pas."
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The thread the message landed in, whole.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`sandbox_only`: the token is a live one; only a sandbox token can simulate a message. Or `insufficient_ability`."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such sandbox customer."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or not allowed; `email` is needed for the `email` channel. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 60 simulated messages in an hour, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/support/threads/{thread}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                }
            ],
            "get": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "getSupportThread",
                "summary": "Get a support thread",
                "description": "The thread whole: its latest 50 messages oldest first, its notes, its history (who did what, when), what was escalated to Monotree from it, and the assistant's latest draft. Where `has_earlier_messages` is true, [List messages](/docs/reference/support-messages#list-support-messages) has the ones before. Reading a thread over the API does not mark it read.",
                "x-ability": "support:read",
                "responses": {
                    "200": {
                        "description": "The thread.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread for your company and mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "updateSupportThread",
                "summary": "Change a support thread",
                "description": "Close, dismiss or reopen it, give it to one of your people, set its priority, kind and tags, put it aside until later, or tie its sender to a customer. Send only what changes. Closing a chat asks the customer under your last answer whether it helped (if `ask_rating` is on and you answered in the last 7 days). Each change shows in the thread's history under the token's name and sends its own `support.thread.updated` event. The call changes all of it or nothing: when one field is refused (404, 409 or 422), no other field is changed and no event is sent.",
                "x-ability": "support:write",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportThreadUpdate"
                            },
                            "example": {
                                "assignee": "sel_5",
                                "priority": "high",
                                "tags": [
                                    "Invitations",
                                    "Login"
                                ],
                                "snoozed_until": "2026-11-20T08:00:00Z"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The thread whole, as it now stands.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, seller (`assignee`) or customer."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: `snoozed_until` is in the past or the thread is closed or dismissed; `status: closed` was sent for a dismissed thread (reopen it first; closing a closed thread changes nothing and answers `200`); or `customer` was sent for a chat, which stays with the company it came from."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a value is not allowed, a tag does not exist, or `unread` is not `false`."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "deleteSupportThread",
                "summary": "Delete a support thread",
                "description": "Removes the thread for good, with its messages, notes, drafts and the files sent with your answers. A last `support.thread.updated` with `change: deleted` is sent. In the portal only an admin can do this, so it needs `support:configure`. To take a thread out of the way and keep it, dismiss it instead.",
                "x-ability": "support:configure",
                "responses": {
                    "204": {
                        "description": "Deleted."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread for your company and mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/threads/{thread}/merge": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                }
            ],
            "post": {
                "tags": [
                    "Support threads"
                ],
                "operationId": "mergeSupportThread",
                "summary": "Merge a thread into another",
                "description": "One conversation that became two threads is made one again: the messages, notes, history, drafts, tags and escalations of this thread go over to `into`, and this thread is gone (its ID then answers 404). The thread that stays keeps its own current draft; the drafts that come over count as earlier rounds that were not used (`superseded`). Only two threads of the same person can be merged. The thread that stays is `open` if their last message has no answer, and sends `support.thread.updated` with `change: merged`.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportMerge"
                            },
                            "example": {
                                "into": "sth_01m7d1eq5nqnr07hphj298061a"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The thread that stayed, whole.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: one of the two threads does not exist for your company and mode."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the two threads are of different people, or are the same thread. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `into` is missing. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/threads/{thread}/messages": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                }
            ],
            "get": {
                "tags": [
                    "Support messages"
                ],
                "operationId": "listSupportMessages",
                "summary": "List messages",
                "description": "The messages of a thread, always oldest first, a page at a time. Without `after` or `before` you get the latest ones. `before` with the id of the first message you have walks back through a long thread; `after` with the id of the last one gives what is new. `has_more` says whether there are more on that side. This list has no cursor: `next_cursor` is always null.",
                "x-ability": "support:read",
                "parameters": [
                    {
                        "name": "after",
                        "in": "query",
                        "description": "Only messages after this one. Not together with `before`.",
                        "schema": {
                            "type": "string",
                            "maxLength": 40,
                            "example": "msg_01m7d1ajqgwbvenrpw7gz6xn25"
                        }
                    },
                    {
                        "name": "before",
                        "in": "query",
                        "description": "Only messages before this one. Not together with `after`.",
                        "schema": {
                            "type": "string",
                            "maxLength": 40,
                            "example": "msg_01m7d1awpxds8kqrrt6733j0d2"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "How many to return, 1 to 100.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50,
                            "example": 50
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of messages, oldest first.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportMessageList"
                                },
                                "example": {
                                    "object": "list",
                                    "data": [
                                        {
                                            "id": "msg_01m7d1ajqgwbvenrpw7gz6xn25",
                                            "object": "support_message",
                                            "direction": "in",
                                            "kind": "message",
                                            "author": {
                                                "type": "customer",
                                                "name": "Sophie Garnier"
                                            },
                                            "body": "Bonjour, mon invitation ne marche pas.",
                                            "edited": false,
                                            "deleted": false,
                                            "attachments": [],
                                            "delivery": null,
                                            "send_state": null,
                                            "sent_at": "2026-11-14T12:43:10Z",
                                            "delivered_at": null
                                        },
                                        {
                                            "id": "msg_01m7d1awpxds8kqrrt6733j0d2",
                                            "object": "support_message",
                                            "direction": "out",
                                            "kind": "message",
                                            "author": {
                                                "type": "api",
                                                "name": "API \u00b7 Back office, production"
                                            },
                                            "body": "Bonjour Sophie, voici le guide.",
                                            "edited": false,
                                            "deleted": false,
                                            "attachments": [
                                                {
                                                    "id": "att_2",
                                                    "name": "guide.pdf",
                                                    "mime": "application/pdf",
                                                    "size": 48213,
                                                    "url": "https://partners.monotree.com/api/v1/support/attachments/att_2"
                                                }
                                            ],
                                            "delivery": {
                                                "state": "delivered",
                                                "error": null,
                                                "delivered_at": "2026-11-14T12:43:21Z"
                                            },
                                            "send_state": "sent",
                                            "sent_at": "2026-11-14T12:43:21Z",
                                            "delivered_at": "2026-11-14T12:43:21Z"
                                        }
                                    ],
                                    "has_more": false,
                                    "next_cursor": null
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or no such message in it (`after`, `before`)."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `after` and `before` were sent together, or `limit` is out of range."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Support messages"
                ],
                "operationId": "replySupportThread",
                "summary": "Answer a support thread",
                "description": "Sends an answer to the customer, in their Support room or by mail as the thread came. Files go in the same JSON body, base64 encoded: up to 8, together at most 25 MB before encoding. The thread becomes `waiting`; a closed thread opens again; a dismissed one must be reopened first. Monotree delivers the answer, and `delivery.state` says how far it got. With `last_seen_message` nothing is sent when they have written again since (409), so you never answer past a message you have not read. The assistant's drafts that were waiting are marked `superseded`. In a thread by mail an answer is a mail: at most 20 an hour to one thread and 200 an hour in all, and it goes to every address on copy too: at most 60 recipients an hour for one thread and 1,000 for all. By chat: 600 answers an hour. With files: 30 answers an hour and 500 MB of files a day. Only these kinds of file are taken, by the ending of the name: pdf, png, jpg, jpeg, gif, webp, heic, txt, csv, doc, docx, xls, xlsx, ppt, pptx, odt, ods, odp, rtf, mp4, mov, m4a and mp3; the content must be what the ending says, and a zip or any other kind is refused. A name is kept without control characters and at most 120 characters long. For a note only your people read, use [Add a note](/docs/reference/support-messages#add-support-note).",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportReply"
                            },
                            "example": {
                                "body": "Bonjour Sophie, voici le guide.",
                                "last_seen_message": "msg_01m7d1ajqgwbvenrpw7gz6xn25",
                                "attachments": [
                                    {
                                        "name": "guide.pdf",
                                        "content": "JVBERi0xLjQK"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The thread whole, with the answer last in `messages`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or `last_seen_message` is not a message of it."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: they have written again since `last_seen_message`, the thread is dismissed, or it is a mail thread with an address that has never written in and is no longer the admin Monotree invited (a token cannot write to it). `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: neither `body` nor `attachments`, more than 8 files, a file that is not base64 or is empty, files that are together larger than 25 MB, an attachment with a field other than `name` and `content`, or a file of a kind that is not taken (anything but the kinds listed above, or content that is not what the name says). `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: in a thread by mail, more than 20 answers to this thread or 200 answers by mail in all in an hour (all your tokens of one mode together), or more recipients than 60 for the thread or 1,000 in all; by chat more than 600 answers an hour; with files more than 30 answers an hour or 500 MB a day; or over the general limit. Wait for the number of seconds in `Retry-After` where there is one, else a few minutes."
                    }
                }
            }
        },
        "/support/threads/{thread}/messages/{message}/retry": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                },
                {
                    "$ref": "#/components/parameters/SupportMessageId"
                }
            ],
            "post": {
                "tags": [
                    "Support messages"
                ],
                "operationId": "retrySupportMessage",
                "summary": "Send a failed answer again",
                "description": "An answer whose `delivery.state` is `failed` is handed to Monotree again. It is the same message, so nothing arrives twice. No body is needed.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The answer, on its way again.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportMessage"
                                },
                                "example": {
                                    "id": "msg_01m7d1awpxds8kqrrt6733j0d2",
                                    "object": "support_message",
                                    "direction": "out",
                                    "kind": "message",
                                    "author": {
                                        "type": "api",
                                        "name": "API \u00b7 Back office, production"
                                    },
                                    "body": "Bonjour Sophie, voici le guide.",
                                    "edited": false,
                                    "deleted": false,
                                    "attachments": [],
                                    "delivery": {
                                        "state": "sent",
                                        "error": null,
                                        "delivered_at": null
                                    },
                                    "send_state": "sent",
                                    "sent_at": "2026-11-14T12:43:21Z",
                                    "delivered_at": null
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or no such message in it."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the message is not an answer of yours that failed. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: in a thread by mail this counts as an answer (20 an hour to one thread, 200 an hour in all); or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/support/threads/{thread}/notes": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                }
            ],
            "post": {
                "tags": [
                    "Support messages"
                ],
                "operationId": "addSupportNote",
                "summary": "Add a note",
                "description": "A note on the thread for your own people. The customer never sees it, and it does not change the thread's status. Notes come back in the thread's `notes`, oldest first; a note cannot be changed or removed. Sends `support.thread.updated` with `change: noted`.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportNoteCreate"
                            },
                            "example": {
                                "body": "Called the manager; she will try again on Monday."
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The note.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportNote"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread for your company and mode."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `body` is missing, empty or longer than 10,000 characters. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/attachments/{attachment}": {
            "parameters": [
                {
                    "name": "attachment",
                    "in": "path",
                    "required": true,
                    "description": "The file's ID, from a message's `attachments`.",
                    "schema": {
                        "type": "string",
                        "example": "att_2"
                    }
                }
            ],
            "get": {
                "tags": [
                    "Support messages"
                ],
                "operationId": "getSupportAttachment",
                "summary": "Download an attachment",
                "description": "The file itself, for a token that may read its thread. This is what `url` points to on a file sent with one of your answers: fetch it with your token in the `Authorization` header. A PNG, JPEG, GIF or WebP picture comes with its own content type; anything else as `application/octet-stream` with the file's name in `Content-Disposition`. A file the customer sent is kept by Monotree: its `url` is that address, and this endpoint redirects to it. The answer says `Cache-Control: private, no-store`: do not keep it in a shared cache.",
                "x-ability": "support:read",
                "responses": {
                    "200": {
                        "description": "The file's bytes.",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            },
                            "image/png": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "302": {
                        "description": "The file is one the customer sent, kept by Monotree: follow `Location`."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such attachment in a thread of your company and mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/threads/{thread}/drafts": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                }
            ],
            "get": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "listSupportDrafts",
                "summary": "List the assistant's drafts",
                "description": "The versions of the assistant's draft for the customer's latest turn (the `round` of the thread's `draft`), the newest version first. The first is the one on the thread as `draft`. Every version comes in one answer: there are no pages. Drafts of earlier rounds are not listed.",
                "x-ability": "support:read",
                "responses": {
                    "200": {
                        "description": "The versions, newest first. Empty where nothing was drafted.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportDraftList"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread for your company and mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "requestSupportDraft",
                "summary": "Ask for a draft",
                "description": "Without `from`, asks the assistant for a draft of an answer to the thread as it stands (no body needed). With `from`, asks for another version of that draft: pick among the options of its `questions` in `answers`, say what to change in `note`, or both; a draft that is `stale` can be redone without either. The new draft becomes the thread's `draft`. It may come back `queued` or `running`: `support.thread.updated` with `change: drafted` is sent when the assistant is done, and the draft is then `ready` or `failed`. In the sandbox it is ready at once.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportDraftRequest"
                            },
                            "example": {
                                "from": "drf_228",
                                "note": "Shorter, please.",
                                "answers": [
                                    {
                                        "q": "Should the answer ask which phone they use now, or only if the first step does not help?",
                                        "a": "Ask now"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The new draft.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportDraft"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or no such draft in it (`from`)."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: a draft is already being written; or, with `from`, that draft is not `ready`, or neither an option of its questions nor a `note` was sent. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `note` is longer than 2,000 characters, or an entry of `answers` lacks `q` or `a`, has one longer than 500 characters, or has another field. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/threads/{thread}/drafts/{draft}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                },
                {
                    "$ref": "#/components/parameters/SupportDraftId"
                }
            ],
            "delete": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "discardSupportDraft",
                "summary": "Put a draft aside",
                "description": "Marks a draft that is ready and not yet used as not used. Nothing is deleted: the draft stays readable, with `outcome` `discarded`, and the answer is the draft (200, not 204).",
                "x-ability": "support:write",
                "responses": {
                    "200": {
                        "description": "The draft, with `outcome: discarded`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportDraft"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or no such draft in it."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the draft is not ready, or was used or put aside already."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/threads/{thread}/drafts/{draft}/send": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                },
                {
                    "$ref": "#/components/parameters/SupportDraftId"
                }
            ],
            "post": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "sendSupportDraft",
                "summary": "Send a draft",
                "description": "Sends a draft that is ready and not yet used as your answer: as the assistant wrote it (no body needed), or with `body` as you changed it. It goes out as an [answer](/docs/reference/support-messages#reply-support-thread) of your token does. The draft's `outcome` then says which: `sent_unchanged`, `edited`, or `replaced` where less than about a third of it was left.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportDraftSend"
                            },
                            "example": {
                                "body": "Bonjour Sophie, essayez de vous d\u00e9connecter et de vous reconnecter. Quel t\u00e9l\u00e9phone utilisez-vous ?",
                                "last_seen_message": "msg_01m7d1b8f34d98pr5q1mnbdcpt"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The thread whole, with the answer last in `messages`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, draft, or message (`last_seen_message`)."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the draft is not ready or was used already; they have written again since `last_seen_message`; the thread is dismissed; or the draft has no text and no `body` was sent. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `body` is empty or longer than 10,000 characters. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: in a thread by mail, more than 20 answers to this thread or 200 answers by mail in all in an hour; or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/support/threads/{thread}/drafts/{draft}/close": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                },
                {
                    "$ref": "#/components/parameters/SupportDraftId"
                }
            ],
            "post": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "closeSupportThreadOnDraft",
                "summary": "Agree there is nothing to answer",
                "description": "Where a draft says `no_reply_needed` (a thank-you, say) and you agree, this closes the thread without an answer, with `resolution` `no_reply`. The draft's `outcome` becomes `no_reply_accepted`. No body is needed.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The thread whole, closed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or no such draft in it."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the draft does not say `no_reply_needed`. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/threads/{thread}/escalations": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                }
            ],
            "post": {
                "tags": [
                    "Support escalations"
                ],
                "operationId": "escalateSupportThread",
                "summary": "Escalate a thread to Monotree",
                "description": "Hands what the thread is about on to Monotree, your second line: a bug, a feature request, or an investigation into a customer's data. Monotree picks it up and says how it stands (`status`). Where the same thing was escalated already, send only `duplicate_of` and the thread is added to that escalation; nothing new goes to Monotree ([Find similar escalations](/docs/reference/support-escalations#find-similar-support-escalations) shows candidates). The thread must belong to a customer, and keeps its status. Sends `support.escalation.created`, or `support.escalation.updated` for a duplicate. In the sandbox nothing reaches Monotree and the escalation stays `sent`.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportEscalationCreate"
                            },
                            "example": {
                                "title": "Invitation link opens a blank page",
                                "category": "bug",
                                "description": "On Android 14 the link in the invitation mail opens a blank page.",
                                "tags": [
                                    1
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The escalation: the new one, or the one the thread was added to.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportEscalation"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or no such escalation of yours (`duplicate_of`)."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the thread has no customer yet; tie its sender to one first. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: without `duplicate_of`, `title` (3 to 120 characters) and `category` are needed. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 20 escalations in an hour (all your tokens of one mode together), or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/support/threads/{thread}/escalations/{escalation}/follow-up": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportThreadId"
                },
                {
                    "$ref": "#/components/parameters/SupportEscalationId"
                }
            ],
            "post": {
                "tags": [
                    "Support escalations"
                ],
                "operationId": "followUpSupportEscalation",
                "summary": "Follow up a released escalation",
                "description": "When Monotree releases what was escalated, each thread it came from shows under the `followup` view until someone says what became of it: `told: true` where the customer was (or is being) told, `false` where nobody needs telling. With `draft: true` the assistant also drafts the message that says it has shipped; it becomes the thread's `draft`, for you to [send](/docs/reference/support-assistant#send-support-draft). Only a released escalation can be followed up; before that the call answers 409. Following up twice changes nothing.",
                "x-ability": "support:write",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportFollowUp"
                            },
                            "example": {
                                "told": true,
                                "draft": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The thread whole.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such support thread, or the escalation is not one of that thread."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: Monotree has not released the escalation yet. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `told` is missing or not a boolean. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/escalations": {
            "get": {
                "tags": [
                    "Support escalations"
                ],
                "operationId": "listSupportEscalations",
                "summary": "List escalations",
                "description": "What you have handed on to Monotree, newest first by when it was escalated, each with the threads it came from. A sandbox token lists the escalations of sandbox customers only.",
                "x-ability": "support:read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "`sent`: waiting for Monotree to pick it up. `received`: Monotree has it. `fixed`: fixed, not yet shipped. `released`: it has shipped. `declined`: Monotree will not do it.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "sent",
                                "received",
                                "fixed",
                                "released",
                                "declined"
                            ],
                            "example": "released"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "description": "What kind of thing it is.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "bug",
                                "feature_request",
                                "investigation"
                            ],
                            "example": "bug"
                        }
                    },
                    {
                        "name": "customer",
                        "in": "query",
                        "description": "Only those of this customer: its ID, or `external_ref:` and your own reference.",
                        "schema": {
                            "type": "string",
                            "maxLength": 140,
                            "example": "external_ref:org_48213"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of escalations.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportEscalationList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such customer for your company and mode."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/escalations/similar": {
            "get": {
                "tags": [
                    "Support escalations"
                ],
                "operationId": "findSimilarSupportEscalations",
                "summary": "Find similar escalations",
                "description": "Escalations of yours that Monotree has not yet released or declined and that share a word of four letters or more with the title and description you are about to send. Those of the `category` you name come first (`bug` where you name none), then the newest. At most five, in one answer. Use one as `duplicate_of` rather than sending the same thing twice.",
                "x-ability": "support:read",
                "parameters": [
                    {
                        "name": "title",
                        "in": "query",
                        "required": true,
                        "description": "The title you are about to send.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120,
                            "example": "Invitation link opens a blank page"
                        }
                    },
                    {
                        "name": "description",
                        "in": "query",
                        "description": "The description you are about to send. Its first 200 characters are used.",
                        "schema": {
                            "type": "string",
                            "maxLength": 10000,
                            "example": "On Android 14 the link in the invitation mail opens a blank page."
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "description": "Escalations of this category come first.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "bug",
                                "feature_request",
                                "investigation"
                            ],
                            "default": "bug",
                            "example": "bug"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Up to five escalations, the likeliest first. Empty where nothing looks alike.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportEscalationList"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `title` is missing, or `category` is not one of the three."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/escalations/{escalation}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/SupportEscalationId"
                }
            ],
            "get": {
                "tags": [
                    "Support escalations"
                ],
                "operationId": "getSupportEscalation",
                "summary": "Get an escalation",
                "description": "One escalation: how it stands at Monotree, and for each thread it came from whether a follow-up is due.",
                "x-ability": "support:read",
                "responses": {
                    "200": {
                        "description": "The escalation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportEscalation"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such escalation for your company and mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/settings": {
            "get": {
                "tags": [
                    "Support desk"
                ],
                "operationId": "getSupportSettings",
                "summary": "Get the desk's settings",
                "description": "How your support desk is set up: the same settings as the Settings tab of the Support page. A sandbox token reads and changes a sandbox desk of its own, which only threads of sandbox customers go by.",
                "x-ability": "support:configure",
                "responses": {
                    "200": {
                        "description": "The settings.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportSettings"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Support desk"
                ],
                "operationId": "updateSupportSettings",
                "summary": "Change the desk's settings",
                "description": "Changes the settings you send and leaves the rest. In `hours`, send only the days that change: a day left out keeps its hours, and `null` closes a day. A value that is not valid is refused with 422 and nothing is changed.",
                "x-ability": "support:configure",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportSettingsUpdate"
                            },
                            "example": {
                                "auto": "drafts",
                                "reopen_days": 14,
                                "hours": {
                                    "mon": [
                                        "08:00",
                                        "17:00"
                                    ],
                                    "tue": [
                                        "08:00",
                                        "17:00"
                                    ],
                                    "wed": [
                                        "08:00",
                                        "17:00"
                                    ],
                                    "thu": [
                                        "08:00",
                                        "17:00"
                                    ],
                                    "fri": [
                                        "08:00",
                                        "16:00"
                                    ],
                                    "sat": null,
                                    "sun": null
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The settings as they now stand.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportSettings"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a value is not allowed, `hours` is missing or lacks a day, or a day closes before it opens."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/presence": {
            "get": {
                "tags": [
                    "Support desk"
                ],
                "operationId": "getSupportPresence",
                "summary": "Get whether support is online",
                "description": "Whether your desk is there to answer right now. The office hours (less the holidays) say, unless someone forced it. While the desk is offline, a new thread gets the automatic reply (if `auto_reply` is on).",
                "x-ability": "support:configure",
                "responses": {
                    "200": {
                        "description": "The presence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportPresence"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Support desk"
                ],
                "operationId": "setSupportPresence",
                "summary": "Switch support online or offline",
                "description": "`true` or `false` forces the desk online or offline whatever the office hours say; `null` follows the hours again. A forced state ends by itself at `forced_until`: online after an hour (an hour after the last answer one of your people sent in the portal), offline when support opens next. Forcing what the hours already say forces nothing and clears a forced state.",
                "x-ability": "support:configure",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportPresenceSet"
                            },
                            "example": {
                                "online": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The presence as it now stands.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportPresence"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: `online` is missing, or is not true, false or null. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/memories": {
            "get": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "listSupportMemories",
                "summary": "List what the assistant was taught",
                "description": "The assistant's memory: facts about how you work that it reads before every draft for your customers. A fact has a name, a line that says what it is about, and the fact itself. Newest first. A sandbox token has a memory of its own.",
                "x-ability": "support:configure",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "`remembered`: facts the assistant uses. `proposed`: what it would remember of an answer of yours, waiting for you to agree.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "remembered",
                                "proposed"
                            ],
                            "default": "remembered",
                            "example": "remembered"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of facts.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportMemoryList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "createSupportMemory",
                "summary": "Teach the assistant a fact",
                "description": "Either write the fact yourself (`name`, `description` and `body`, all three), which the assistant uses from then on, or send only `from_message` with one of your answers and the assistant proposes what it would remember of it: that comes back `proposed`, and counts once you [agree to it](/docs/reference/support-assistant#update-support-memory). An answer can be learned from once.",
                "x-ability": "support:configure",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportMemoryCreate"
                            },
                            "example": {
                                "name": "Employees are added by the admin",
                                "description": "Employees are added by the customer's admin",
                                "body": "Only the admin of a customer can add employees: Users, then Invite. Support never adds them."
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The fact (`remembered`), or the proposal (`proposed`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportMemory"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: `from_message` is not a message in a thread of your company and mode."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`nothing_to_learn`: the assistant found nothing in that answer worth remembering. `invalid_state`: the message is not an answer of yours, or was learned from already; or `name` has no letters or digits. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: without `from_message`, `name`, `description` and `body` are all needed. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/support/memories/{memory}": {
            "parameters": [
                {
                    "name": "memory",
                    "in": "path",
                    "required": true,
                    "description": "The fact's ID.",
                    "schema": {
                        "type": "string",
                        "example": "mem_6"
                    }
                }
            ],
            "patch": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "updateSupportMemory",
                "summary": "Change a fact",
                "description": "Changes what you send of a fact and leaves the rest. A proposal becomes a fact with it, even with an empty JSON object as the body: that is how you agree to one.",
                "x-ability": "support:configure",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SupportMemoryUpdate"
                            },
                            "example": {
                                "body": "Only the admin of a customer can add employees: Users, then Invite."
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The fact, `remembered`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SupportMemory"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such fact for your company and mode."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`invalid_state`: the name would be left with no letters or digits."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is empty or too long."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Support assistant"
                ],
                "operationId": "deleteSupportMemory",
                "summary": "Forget a fact",
                "description": "Removes a fact, or turns a proposal down. The assistant no longer reads it.",
                "x-ability": "support:configure",
                "responses": {
                    "204": {
                        "description": "Forgotten."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such fact for your company and mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/webhooks": {
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "listWebhooks",
                "summary": "List webhook endpoints",
                "description": "Your webhook endpoints of the token's mode (live or sandbox), newest first. Only the endpoints the token may touch are listed: those whose events it may all read, both the types an endpoint is subscribed to and the types among the deliveries it still holds. See [Which endpoints a token sees](/docs/webhooks#token-endpoints).",
                "x-ability": "webhooks:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of endpoints.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpointList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "createWebhook",
                "summary": "Add a webhook endpoint",
                "description": "Adds an endpoint for the token's mode: one added with a sandbox token gets sandbox events only. The signing secret is in the answer to this call only; store it. The URL must be https and lead to a public address: one whose host resolves to a private, loopback, link-local or reserved address is refused, here and again on every delivery. At most 10 endpoints per mode. An endpoint is only sent events its maker may read: the token needs the ability that reads each type in `events` (`customers:read` for `customer.*`, `seller.*` and `adoption.*` events, `support:read` for `support.*`, `webhooks:manage` for `webhook_endpoint.*`), and all of them for `*`, which is also what leaving `events` out means. Otherwise the answer is `403` and names the ability that is missing.",
                "x-ability": "webhooks:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEndpointCreate"
                            },
                            "example": {
                                "url": "https://api.acme.example/hooks/monotree",
                                "description": "Back office, production",
                                "events": [
                                    "customer.live",
                                    "customer.failed"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The endpoint, with its secret.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpoint"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`insufficient_ability`: the token lacks `webhooks:manage`, or the ability that reads one of the `events` asked for (all of them for `*` or when `events` is left out). The message names it."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`limit_reached`: you already have 10 endpoints in this mode. `endpoints_busy`: another request is adding an endpoint right now; try again in a moment. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running. `idempotency_key_taken`: the key was used by another of your tokens."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/webhooks/{webhook}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                }
            ],
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "getWebhook",
                "summary": "Get a webhook endpoint",
                "description": "One endpoint with its health: `failed_24h` and `last_delivery`. The signing secret is not in this answer. A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints).",
                "x-ability": "webhooks:manage",
                "responses": {
                    "200": {
                        "description": "The endpoint.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpoint"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "updateWebhook",
                "summary": "Change a webhook endpoint",
                "description": "Change the URL or the events, or pause it with `active: false`. `active: true` switches a paused endpoint on again, also one Monotree paused because it only failed. New `events` need the abilities that read them, as when [adding one](/docs/reference/webhooks#create-webhook): a token cannot widen an endpoint to events it may not read (`403`). A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints). So a token cannot point, pause or describe an endpoint for events it may not read either.",
                "x-ability": "webhooks:manage",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEndpointUpdate"
                            },
                            "example": {
                                "events": [
                                    "customer.live",
                                    "customer.failed",
                                    "customer.cancelled"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The endpoint.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpoint"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`insufficient_ability`: the token lacks `webhooks:manage`, or `url` or `events` was sent and the token lacks the ability that reads one of the endpoint's events. The message names it."
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "deleteWebhook",
                "summary": "Delete a webhook endpoint",
                "description": "Removes the endpoint and its delivery log. Events that happen from now on are no longer sent to it; they stay in [List events](/docs/reference/events#list-events). A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints).",
                "x-ability": "webhooks:manage",
                "responses": {
                    "204": {
                        "description": "Deleted."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/webhooks/{webhook}/test": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                }
            ],
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "testWebhook",
                "summary": "Send a test event",
                "description": "Sends a `ping` event to the endpoint at once and answers with the delivery: its `status`, your server's `response_code` and `response_body`. A failed test is not retried. At most 10 test events and redeliveries a minute to one endpoint. A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints).",
                "x-ability": "webhooks:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "202": {
                        "description": "The delivery.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDelivery"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 10 test events and redeliveries to this endpoint in a minute, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/webhooks/{webhook}/rotate-secret": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                }
            ],
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "rotateWebhookSecret",
                "summary": "Rotate the signing secret",
                "description": "Gives the endpoint a new signing secret, in the answer to this call only. The secret before it stays valid\nfor `expire_previous_in` seconds: until then every event is signed with both (two `v1` values in\n`Monotree-Signature`), so your server keeps accepting events while you move it to the new secret.\n\nA token only finds an endpoint whose events it may all read; any other endpoint answers `404`\n([Which endpoints a token sees](/docs/webhooks#token-endpoints)): a secret is not rotated by a token that\nmay not read what the secret signs.\n",
                "x-ability": "webhooks:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expire_previous_in": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 604800,
                                        "default": 86400,
                                        "description": "Seconds the previous secret stays valid: a day unless you say otherwise, a week at most, `0` to stop it at once.",
                                        "example": 3600
                                    }
                                }
                            },
                            "example": {
                                "expire_previous_in": 3600
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The endpoint, with its new secret.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpoint"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 10 rotations in an hour for this endpoint, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/webhooks/{webhook}/deliveries": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                }
            ],
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "listWebhookDeliveries",
                "summary": "List deliveries",
                "description": "The deliveries to the endpoint, newest first, with the status code your server answered. A delivery is one event sent to one endpoint, with all its tries. Deliveries are kept for 30 days. Ask for one delivery to see the body sent and your server's answer. A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints).",
                "x-ability": "webhooks:manage",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Only deliveries in this state: `failed` ones gave up after six tries, `retrying` ones have a try planned at `next_attempt_at`.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pending",
                                "delivered",
                                "retrying",
                                "failed"
                            ]
                        }
                    },
                    {
                        "name": "event_id",
                        "in": "query",
                        "description": "Only the deliveries of this event (`evt_\u2026`), to see whether and how one event reached the endpoint.",
                        "schema": {
                            "type": "string",
                            "example": "evt_01jcz8wg4h7v3y6n9q2k5m8p1r"
                        }
                    },
                    {
                        "name": "event",
                        "in": "query",
                        "description": "Only deliveries of this event type.",
                        "schema": {
                            "type": "string",
                            "example": "customer.live"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of deliveries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDeliveryList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/webhooks/{webhook}/deliveries/redeliver-failed": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                }
            ],
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "redeliverFailedWebhookDeliveries",
                "summary": "Redeliver failed deliveries",
                "description": "Queues the endpoint's failed deliveries of the last 24 hours again, up to 100, for example after your server was down. Each starts over as with Redeliver a delivery, but is sent from the queue rather than at once. A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints).",
                "x-ability": "webhooks:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "202": {
                        "description": "The deliveries queued again, `pending`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDeliveryList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`endpoint_paused`: the endpoint is paused; switch it on first. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 10 of these calls in an hour for this endpoint, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/webhooks/{webhook}/deliveries/{delivery}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                },
                {
                    "$ref": "#/components/parameters/WebhookDeliveryId"
                }
            ],
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "getWebhookDelivery",
                "summary": "Get a delivery",
                "description": "One delivery, with the body sent (`payload`) and the first 2,000 bytes of your server's last answer (`response_body`). A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints).",
                "x-ability": "webhooks:manage",
                "responses": {
                    "200": {
                        "description": "The delivery.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDelivery"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint or delivery."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/webhooks/{webhook}/deliveries/{delivery}/redeliver": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/WebhookId"
                },
                {
                    "$ref": "#/components/parameters/WebhookDeliveryId"
                }
            ],
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "operationId": "redeliverWebhookDelivery",
                "summary": "Redeliver a delivery",
                "description": "Sends the delivery again at once and answers with how it went. Works on failed deliveries and on delivered ones, to try a fix on your side. The delivery starts over: same delivery ID, same body and event `id`, attempts from 0, and the usual retries if this try fails. A retry that was planned is replaced, not added to. Refused while the endpoint is paused or a try is being sent. At most 10 redeliveries and test events a minute to one endpoint. A token only finds an endpoint whose events it may all read (the types it is subscribed to and the types among its deliveries); any other endpoint answers `404`: see [Which endpoints a token sees](/docs/webhooks#token-endpoints). The token must be able to read the delivery's event type.",
                "x-ability": "webhooks:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "responses": {
                    "202": {
                        "description": "The delivery, after the try.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookDelivery"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such webhook endpoint or delivery."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`endpoint_paused`: the endpoint is paused; switch it on first. `delivery_in_progress`: a try of this delivery is being sent right now. `idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited",
                        "description": "`rate_limited`: more than 10 redeliveries and test events to this endpoint in a minute, or over the general limit. Wait for the number of seconds in `Retry-After`."
                    }
                }
            }
        },
        "/tokens": {
            "get": {
                "tags": [
                    "Tokens"
                ],
                "operationId": "listTokens",
                "summary": "List API tokens",
                "description": "Your company's tokens of the calling token's mode, newest first: a live token lists live tokens, a sandbox token sandbox tokens. A token's value is never shown again; you see its `hint`.",
                "x-ability": "tokens:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of tokens.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TokenList"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_cursor`: the `cursor` is not one this API gave out."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Tokens"
                ],
                "operationId": "createToken",
                "summary": "Create an API token",
                "description": "Creates a token, for example to rotate one without signing in to the portal. The token's value is in this answer only. The new token is of the calling token's mode; a live token may also ask for a sandbox one with `sandbox: true`. A token can only give abilities it has itself, and a token that expires cannot make one that lasts longer: the new token then needs an `expires_at` no later than its own. With `expires_at` the token stops working at that time: calls with it then answer `401 invalid_token`. A token made this way is revoked together with the token that made it.",
                "x-ability": "tokens:manage",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKeyOptional"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/TokenCreate"
                            },
                            "example": {
                                "name": "Reporting, read only",
                                "abilities": [
                                    "customers:read"
                                ],
                                "expires_at": "2027-11-14T00:00:00Z"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The token, with its secret value.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Token"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequest",
                        "description": "`invalid_idempotency_key`: the `Idempotency-Key` is longer than 255 characters."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden",
                        "description": "`insufficient_ability`: the token lacks `tokens:manage`, or asks for an ability it does not have itself. `sandbox_only`: a sandbox token asked for a live token."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict",
                        "description": "`idempotency_in_progress`: a call with the same `Idempotency-Key` is still running."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError",
                        "description": "`validation_error`: a field is missing or invalid; `fields` says which. On `expires_at` also when the calling token expires and the new token has no `expires_at`, or one later than the calling token's. `idempotency_key_reused`: the `Idempotency-Key` was used for a different request."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/tokens/{token}": {
            "delete": {
                "tags": [
                    "Tokens"
                ],
                "operationId": "revokeToken",
                "summary": "Revoke an API token",
                "description": "Calls with the token are refused from now on. Every token it created over the API is revoked with it, and every token those created, and so on, whatever their mode. A token may revoke itself, and other tokens of its own mode only: a sandbox token cannot revoke a live one (`404`).",
                "x-ability": "tokens:manage",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "description": "The token's ID (`tok_\u2026`), from List API tokens or Who am I.",
                        "schema": {
                            "type": "string",
                            "example": "tok_7"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Revoked."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound",
                        "description": "`not_found`: no such token in the calling token's mode."
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "An API token from Developers in the portal, sent as `Authorization: Bearer mpt_live_\u2026` (or `mpt_test_\u2026` for the sandbox)."
            }
        },
        "parameters": {
            "CustomerId": {
                "name": "customer",
                "in": "path",
                "required": true,
                "description": "The customer's ID (`cus_\u2026`), or `external_ref:` followed by your own reference, such as `external_ref:org_48213`.",
                "schema": {
                    "type": "string",
                    "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                }
            },
            "WebhookId": {
                "name": "webhook",
                "in": "path",
                "required": true,
                "description": "The webhook endpoint's ID (`whe_\u2026`).",
                "schema": {
                    "type": "string",
                    "example": "whe_01jd1f4c8m2p0r6t9w3y5a7c1e"
                }
            },
            "WebhookDeliveryId": {
                "name": "delivery",
                "in": "path",
                "required": true,
                "description": "The delivery's ID (`whd_\u2026`), as sent in the `Monotree-Delivery` header.",
                "schema": {
                    "type": "string",
                    "example": "whd_01jd1g2h3j4k5m6n7p8q9r0s1t"
                }
            },
            "SellerId": {
                "name": "seller",
                "in": "path",
                "required": true,
                "description": "The seller's ID (`sel_5`), or `external_ref:` followed by your own reference for them (`external_ref:usr_20503`). A seller added by an email address has no reference until you give them one.",
                "schema": {
                    "type": "string",
                    "example": "sel_5"
                }
            },
            "SupportThreadId": {
                "name": "thread",
                "in": "path",
                "required": true,
                "description": "The thread's ID.",
                "schema": {
                    "type": "string",
                    "example": "sth_01m7d1ajq9w7ak2vnnp8hfdwj8"
                }
            },
            "SupportMessageId": {
                "name": "message",
                "in": "path",
                "required": true,
                "description": "The message's ID. It must be a message of the thread in the path.",
                "schema": {
                    "type": "string",
                    "example": "msg_01m7d1awpxds8kqrrt6733j0d2"
                }
            },
            "SupportDraftId": {
                "name": "draft",
                "in": "path",
                "required": true,
                "description": "The draft's ID. It must be a draft of the thread in the path.",
                "schema": {
                    "type": "string",
                    "example": "drf_229"
                }
            },
            "SupportEscalationId": {
                "name": "escalation",
                "in": "path",
                "required": true,
                "description": "The escalation's ID.",
                "schema": {
                    "type": "string",
                    "example": "esc_01m7d1cbwj6agthjesfk7198t7"
                }
            },
            "SellerFilter": {
                "name": "seller",
                "in": "query",
                "description": "Only what belongs to this seller: their ID (`sel_12`), or `external_ref:` followed by your own reference for them (`external_ref:usr_20503`). The same on every list that takes `seller`. A seller that does not exist answers `404`.",
                "schema": {
                    "type": "string",
                    "maxLength": 140,
                    "example": "external_ref:usr_20503"
                }
            },
            "Limit": {
                "name": "limit",
                "in": "query",
                "description": "How many to return in a page, 1 to 100.",
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 25
                }
            },
            "Cursor": {
                "name": "cursor",
                "in": "query",
                "description": "The `next_cursor` of the page before, for the next page. Send the same filters with it.",
                "schema": {
                    "type": "string",
                    "maxLength": 200,
                    "example": "6Yb0mT9wQ3F7ImlkIjo1MTF9"
                }
            },
            "IdempotencyKey": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": true,
                "description": "Required. Any unique string up to 255 characters, such as a UUID. A repeat with the same key and body returns the first answer; with a different body it is refused. Keys are scoped to your partner and mode (live or sandbox), and a kept answer is only given to the token that sent the key: another of your tokens gets `409 idempotency_key_taken`.",
                "schema": {
                    "type": "string",
                    "maxLength": 255,
                    "example": "6f1c2a3e-8b4d-4f7a-9c2e-1d5b7a9e3f10"
                }
            },
            "IdempotencyKeyOptional": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": false,
                "description": "Optional. Any unique string up to 255 characters, such as a UUID. Makes a retry of this call safe: a repeat with the same key and body returns the first answer. Keys are scoped to your partner and mode (live or sandbox), and a kept answer is only given to the token that sent the key: another of your tokens gets `409 idempotency_key_taken`.",
                "schema": {
                    "type": "string",
                    "maxLength": 255,
                    "example": "6f1c2a3e-8b4d-4f7a-9c2e-1d5b7a9e3f10"
                }
            }
        },
        "responses": {
            "BadRequest": {
                "description": "`idempotency_key_required`: this call needs an `Idempotency-Key` header.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "error": {
                                "type": "idempotency_key_required",
                                "message": "This request needs an Idempotency-Key header (any unique string up to 255 characters, e.g. a UUID)."
                            }
                        }
                    }
                }
            },
            "Unauthorized": {
                "description": "`invalid_token`: the token is missing, revoked or expired.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "error": {
                                "type": "invalid_token",
                                "message": "The API token is missing, revoked or expired. Send it as \"Authorization: Bearer mpt_live_\u2026\"."
                            }
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "`insufficient_ability`: the token lacks the ability this call needs.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "error": {
                                "type": "insufficient_ability",
                                "message": "This request needs the customers:write ability."
                            }
                        }
                    }
                }
            },
            "NotFound": {
                "description": "`not_found`: no such object for your company in the token's mode.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "error": {
                                "type": "not_found",
                                "message": "No such customer."
                            }
                        }
                    }
                }
            },
            "Conflict": {
                "description": "Understood, but not possible in the object's current state.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "error": {
                                "type": "invalid_state",
                                "message": "Only a live customer can be suspended."
                            }
                        }
                    }
                }
            },
            "ValidationError": {
                "description": "`validation_error`: a field or query parameter is missing or invalid, or the query holds a parameter this call does not take; `fields` says which.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "error": {
                                "type": "validation_error",
                                "message": "Some fields are missing or invalid.",
                                "fields": {
                                    "company_id": [
                                        "This company ID is taken."
                                    ],
                                    "admin.email": [
                                        "The admin email field must be a valid email address."
                                    ]
                                }
                            }
                        }
                    }
                }
            },
            "RateLimited": {
                "description": "`rate_limited`: too many requests. The general limit is 120 requests a minute for all your tokens of one mode (live or sandbox) together, and 300 a minute per IP address before the token is checked. Some calls have a lower limit of their own, which counts only calls that did what they ask (a call refused with another error uses up no place); the [Rate limits](/docs/rate-limits) guide lists them. Wait for the number of seconds in the `Retry-After` header.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "error": {
                                "type": "rate_limited",
                                "message": "Too many requests. Wait for the number of seconds in the Retry-After header."
                            }
                        }
                    }
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "required": [
                            "type",
                            "message"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "description": "A stable code to act on, such as `validation_error`, `not_found` or `invalid_state`. The Errors guide lists them all.",
                                "example": "validation_error"
                            },
                            "message": {
                                "type": "string",
                                "description": "A sentence for a person. It may change; do not match on it."
                            },
                            "fields": {
                                "type": "object",
                                "description": "For `validation_error`, the messages per field, in dot notation for nested fields.",
                                "additionalProperties": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "CustomerStatus": {
                "type": "string",
                "enum": [
                    "draft",
                    "provisioning",
                    "live",
                    "failed",
                    "suspended",
                    "cancelled",
                    "deleted"
                ],
                "example": "live",
                "description": "`draft` saved, not submitted \u00b7 `provisioning` being set up \u00b7 `live` in use \u00b7 `failed` setup stopped, see\n`failure_reason` \u00b7 `suspended` access paused \u00b7 `cancelled` access ended, deleted at `delete_after` \u00b7 `deleted` gone.\n"
            },
            "Language": {
                "type": "string",
                "enum": [
                    "en",
                    "fr",
                    "es",
                    "it",
                    "de",
                    "nl",
                    "pt",
                    "da",
                    "sv",
                    "no",
                    "fi",
                    "pl"
                ]
            },
            "Country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2.",
                "enum": [
                    "FR",
                    "BE",
                    "CH",
                    "LU",
                    "ES",
                    "PT",
                    "IT",
                    "DE",
                    "AT",
                    "NL",
                    "GB",
                    "IE",
                    "DK",
                    "SE",
                    "NO",
                    "FI",
                    "PL"
                ]
            },
            "Logo": {
                "type": "object",
                "required": [
                    "format",
                    "content"
                ],
                "properties": {
                    "format": {
                        "type": "string",
                        "enum": [
                            "svg",
                            "png"
                        ]
                    },
                    "content": {
                        "type": "string",
                        "description": "The file, base64 encoded. At most 512 KB before encoding. An SVG with a script, an event handler or foreign content is refused; anything else that is not drawing is dropped."
                    }
                }
            },
            "Admin": {
                "type": "object",
                "required": [
                    "name",
                    "email"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 80,
                        "example": "Claire Martin"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 120,
                        "example": "claire@boulangeriemartin.example",
                        "description": "The invitation goes here."
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 30,
                        "pattern": "^\\+?[0-9 ().-]{6,30}$",
                        "example": "+33 6 12 34 56 78"
                    }
                }
            },
            "CustomerCreate": {
                "type": "object",
                "required": [
                    "company_name",
                    "company_id",
                    "country",
                    "employees",
                    "default_language",
                    "admin",
                    "terms_accepted"
                ],
                "description": "With `draft: true` only `company_name` is required: a draft is a sign-up that is not finished. What you do send is checked, and everything else is asked for when the draft is submitted.",
                "properties": {
                    "company_name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 80,
                        "description": "The name employees see.",
                        "example": "Boulangerie Martin"
                    },
                    "company_id": {
                        "type": "string",
                        "pattern": "^[a-z0-9]+$",
                        "minLength": 3,
                        "maxLength": 40,
                        "description": "The customer's address (`<company_id>.monotree.com`) and what its employees type in the app. Lower-case letters and digits only, never a hyphen. Must be free: see Check a company ID.",
                        "example": "boulangeriemartin"
                    },
                    "country": {
                        "$ref": "#/components/schemas/Country"
                    },
                    "employees": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 250,
                        "description": "Everyone who will use the app.",
                        "example": 18
                    },
                    "default_language": {
                        "$ref": "#/components/schemas/Language"
                    },
                    "languages": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 12,
                        "items": {
                            "$ref": "#/components/schemas/Language"
                        },
                        "description": "The languages employees can pick. The default language is always included, also when you leave it out.",
                        "example": [
                            "fr",
                            "en"
                        ]
                    },
                    "admin": {
                        "$ref": "#/components/schemas/Admin"
                    },
                    "brand": {
                        "type": "object",
                        "properties": {
                            "primary_color": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^#[0-9a-fA-F]{6}$",
                                "example": "#b45309",
                                "description": "The main colour, as `#rrggbb`."
                            },
                            "secondary_color": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "pattern": "^#[0-9a-fA-F]{6}$",
                                "description": "An accent colour, as `#rrggbb`."
                            },
                            "logo_light": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Logo"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "For a light background."
                            },
                            "logo_dark": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Logo"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "For dark mode."
                            }
                        }
                    },
                    "skello": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "x-connection": "skello",
                        "description": "Only for partners with the Skello connection: anyone else leaves it out (`422` otherwise). The customer's own credentials there, which Monotree uses to import its employees. `null` removes the connection. The guide Changing a customer has a section on it.",
                        "required": [
                            "organisation_id"
                        ],
                        "properties": {
                            "organisation_id": {
                                "type": "string",
                                "maxLength": 64,
                                "pattern": "^[A-Za-z0-9_-]+$",
                                "description": "The customer's organisation ID there."
                            },
                            "api_key": {
                                "type": "string",
                                "minLength": 16,
                                "maxLength": 200,
                                "writeOnly": true,
                                "description": "The customer's API key there. Required when the connection is first sent; left out later, the stored key is kept. Kept encrypted and never returned."
                            }
                        }
                    },
                    "seller_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 120,
                        "description": "Who signed the customer: your own reference for the seller (their `external_ref`) or their email. A reference seen for the first time adds a seller without a login. An email address none of your sellers has adds one too, with the address as their `external_ref`: that needs the `sellers:write` ability as well (`403` without) and is limited to 60 an hour (`429`). The answer never depends on whether anyone else uses the address.",
                        "example": "usr_20503"
                    },
                    "seller_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 80,
                        "description": "The seller's name, used when `seller_ref` is new.",
                        "example": "Emma Dubois"
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 120,
                        "description": "Your own reference for the customer, such as the ID of the organisation in your system. One customer per reference and mode (deleted customers aside), without `/`, `?` or `#`. Use it to find the customer (`?external_ref=`) or in place of its ID (`/customers/external_ref:org_48213`).",
                        "example": "org_48213"
                    },
                    "terms_accepted": {
                        "type": "boolean",
                        "const": true,
                        "description": "The customer has agreed to the Monotree terms and data processing agreement. A draft may leave it out and send it with Submit a draft."
                    },
                    "draft": {
                        "type": "boolean",
                        "default": false,
                        "description": "Only save it; submit it later with Submit a draft. A draft needs a `company_name` and nothing else: the other required fields, and `terms_accepted`, may come later."
                    }
                }
            },
            "CustomerUpdate": {
                "type": "object",
                "description": "Any of these; only what is sent changes. `null` clears an optional field.",
                "properties": {
                    "company_name": {
                        "$ref": "#/components/schemas/CustomerCreate/properties/company_name"
                    },
                    "company_id": {
                        "type": "string",
                        "pattern": "^[a-z0-9]+$",
                        "minLength": 3,
                        "maxLength": 40,
                        "description": "Only before the customer is submitted, or while its setup is `failed`. Refused with `422` otherwise."
                    },
                    "country": {
                        "$ref": "#/components/schemas/Country"
                    },
                    "employees": {
                        "$ref": "#/components/schemas/CustomerCreate/properties/employees"
                    },
                    "default_language": {
                        "$ref": "#/components/schemas/Language"
                    },
                    "languages": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 12,
                        "items": {
                            "$ref": "#/components/schemas/Language"
                        },
                        "description": "The whole list, replacing the one before. It must include the default language."
                    },
                    "admin": {
                        "$ref": "#/components/schemas/Admin",
                        "description": "The whole admin: `name` and `email` together. A new email invites that person."
                    },
                    "brand": {
                        "$ref": "#/components/schemas/CustomerCreate/properties/brand"
                    },
                    "skello": {
                        "$ref": "#/components/schemas/CustomerCreate/properties/skello"
                    },
                    "external_ref": {
                        "$ref": "#/components/schemas/CustomerCreate/properties/external_ref"
                    }
                }
            },
            "Customer": {
                "type": "object",
                "required": [
                    "id",
                    "object",
                    "status",
                    "company_name",
                    "company_id",
                    "url",
                    "country",
                    "employees",
                    "default_language",
                    "languages",
                    "admin",
                    "brand",
                    "provisioning",
                    "changes_pending",
                    "sandbox",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                    },
                    "object": {
                        "type": "string",
                        "const": "customer"
                    },
                    "status": {
                        "$ref": "#/components/schemas/CustomerStatus"
                    },
                    "company_name": {
                        "type": "string",
                        "example": "Boulangerie Martin"
                    },
                    "company_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "boulangeriemartin",
                        "description": "Null only on a draft that has none yet."
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "example": "https://boulangeriemartin.monotree.com",
                        "description": "Null only on a draft without a company ID."
                    },
                    "country": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Country"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Null only on a draft that has none yet."
                    },
                    "employees": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "example": 18,
                        "description": "Null only on a draft that has none yet."
                    },
                    "default_language": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Language"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Null only on a draft that has none yet."
                    },
                    "languages": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Language"
                        },
                        "example": [
                            "fr",
                            "en"
                        ],
                        "description": "Empty only on a draft that has none yet."
                    },
                    "admin": {
                        "type": "object",
                        "required": [
                            "name",
                            "email",
                            "phone"
                        ],
                        "description": "The customer's admin. `name` and `email` are null on a draft that has no admin yet. All three are null once the customer is `deleted`: the admin's name and contact details are removed with it.",
                        "properties": {
                            "name": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "Claire Martin"
                            },
                            "email": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "claire@boulangeriemartin.example"
                            },
                            "phone": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "brand": {
                        "type": "object",
                        "required": [
                            "primary_color",
                            "secondary_color",
                            "logo_light_url",
                            "logo_dark_url"
                        ],
                        "properties": {
                            "primary_color": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "#b45309"
                            },
                            "secondary_color": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "logo_light_url": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "uri",
                                "description": "A link to the stored logo, to show in your own product. Null when there is none."
                            },
                            "logo_dark_url": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "uri"
                            }
                        }
                    },
                    "skello": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "x-connection": "skello",
                        "description": "Only for partners with the Skello connection: the field is left out of everyone else's answers and events. Null for a customer without the connection.",
                        "properties": {
                            "organisation_id": {
                                "type": "string"
                            },
                            "connected": {
                                "type": "boolean",
                                "description": "An API key is stored."
                            }
                        }
                    },
                    "seller": {
                        "$ref": "#/components/schemas/SellerRef"
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "org_48213"
                    },
                    "provisioning": {
                        "type": "object",
                        "description": "Where the setup is.",
                        "required": [
                            "step",
                            "step_label",
                            "steps_done",
                            "steps_total",
                            "failure_reason"
                        ],
                        "properties": {
                            "step": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "reserve",
                                    "install",
                                    "brand",
                                    "languages",
                                    "admin",
                                    "checks",
                                    null
                                ],
                                "description": "The step the setup is on, or stopped on. Null before it starts and once the customer is live. Steps may be added in later versions.",
                                "example": "brand"
                            },
                            "step_label": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "The step in words, in English.",
                                "example": "Applying the logo and colours"
                            },
                            "steps_done": {
                                "type": "integer",
                                "example": 2
                            },
                            "steps_total": {
                                "type": "integer",
                                "example": 6
                            },
                            "failure_reason": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Why the setup stopped, as a sentence for a person. Set while `status` is `failed`."
                            }
                        }
                    },
                    "changes_pending": {
                        "type": "boolean",
                        "description": "A change is saved and on its way to the customer's app."
                    },
                    "adoption": {
                        "$ref": "#/components/schemas/CustomerAdoption"
                    },
                    "sandbox": {
                        "type": "boolean",
                        "description": "True for a test customer made with a sandbox token."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When its settings or state last changed. What `updated_since` filters on."
                    },
                    "submitted_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "live_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "suspended_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "cancelled_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "delete_after": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When a cancelled customer is deleted: 30 days after `cancelled_at`. Null for a customer that is not cancelled, and once it is deleted."
                    }
                },
                "example": {
                    "id": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                    "object": "customer",
                    "status": "live",
                    "company_name": "Boulangerie Martin",
                    "company_id": "boulangeriemartin",
                    "url": "https://boulangeriemartin.monotree.com",
                    "country": "FR",
                    "employees": 18,
                    "default_language": "fr",
                    "languages": [
                        "fr",
                        "en"
                    ],
                    "admin": {
                        "name": "Claire Martin",
                        "email": "claire@boulangeriemartin.example",
                        "phone": null
                    },
                    "brand": {
                        "primary_color": "#b45309",
                        "secondary_color": null,
                        "logo_light_url": null,
                        "logo_dark_url": null
                    },
                    "seller": {
                        "id": "sel_13",
                        "name": "Emma Dubois",
                        "external_ref": "usr_20503"
                    },
                    "external_ref": "org_48213",
                    "provisioning": {
                        "step": null,
                        "step_label": null,
                        "steps_done": 6,
                        "steps_total": 6,
                        "failure_reason": null
                    },
                    "changes_pending": false,
                    "adoption": null,
                    "sandbox": false,
                    "created_at": "2026-11-12T09:41:00Z",
                    "updated_at": "2026-11-12T09:42:18Z",
                    "submitted_at": "2026-11-12T09:41:00Z",
                    "live_at": "2026-11-12T09:42:18Z",
                    "suspended_at": null,
                    "cancelled_at": null,
                    "delete_after": null
                }
            },
            "CustomerDuplicate": {
                "type": "object",
                "required": [
                    "id",
                    "object",
                    "company_name",
                    "admin_email",
                    "status",
                    "seller",
                    "created_at",
                    "match"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                    },
                    "object": {
                        "type": "string",
                        "const": "customer_duplicate"
                    },
                    "company_name": {
                        "type": "string",
                        "example": "Boulangerie Martin"
                    },
                    "admin_email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "claire@boulangeriemartin.example"
                    },
                    "status": {
                        "$ref": "#/components/schemas/CustomerStatus"
                    },
                    "seller": {
                        "$ref": "#/components/schemas/SellerRef"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "match": {
                        "type": "string",
                        "enum": [
                            "name",
                            "admin_email"
                        ],
                        "description": "What it has in common with the customer you asked about. A customer that matches on both is listed once, as `admin_email`."
                    }
                }
            },
            "CustomerDuplicateList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/CustomerDuplicate"
                                }
                            }
                        }
                    }
                ]
            },
            "CustomerList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    }
                ]
            },
            "ListMeta": {
                "type": "object",
                "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "list"
                    },
                    "has_more": {
                        "type": "boolean",
                        "description": "Whether there is a page after this one.",
                        "example": false
                    },
                    "next_cursor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Pass as `cursor` for the next page."
                    }
                }
            },
            "CompanyIdCheck": {
                "type": "object",
                "required": [
                    "object",
                    "company_id",
                    "available"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "company_id"
                    },
                    "company_id": {
                        "type": "string",
                        "description": "The ID that was checked, in lower case.",
                        "example": "boulangeriemartin"
                    },
                    "available": {
                        "type": "boolean",
                        "example": true
                    },
                    "reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "taken",
                            "reserved",
                            "invalid",
                            null
                        ],
                        "description": "Why it is not available; null when it is.",
                        "example": null
                    },
                    "suggestion": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "A free company ID close to the one asked for, when there is one. Null when the ID is available, when it is reserved, and when no free one was found.",
                        "example": null
                    }
                }
            },
            "Actor": {
                "type": "object",
                "description": "Who did it: a person in the portal (`user`), an API token (`token`, named `API \u00b7 <token name>`) or Monotree itself (`system`). On support events also the assistant (`assistant`), and on `support.message.received` the person at the customer who wrote (`customer`).",
                "required": [
                    "type",
                    "name"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "user",
                            "token",
                            "system",
                            "assistant",
                            "customer"
                        ],
                        "example": "system"
                    },
                    "name": {
                        "type": "string",
                        "example": "Monotree"
                    }
                }
            },
            "Event": {
                "type": "object",
                "description": "An event as it is sent to webhook endpoints and returned by List events: the same body, byte for byte in meaning.",
                "required": [
                    "id",
                    "object",
                    "type",
                    "created_at",
                    "sandbox",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "The same on every delivery and redelivery of the event; also in the `Monotree-Event-Id` header. Keep it to skip repeats.",
                        "example": "evt_01jcz8wg4h7v3y6n9q2k5m8p1r"
                    },
                    "object": {
                        "type": "string",
                        "const": "event"
                    },
                    "type": {
                        "type": "string",
                        "description": "See the Event types guide.",
                        "example": "customer.live"
                    },
                    "api_version": {
                        "type": "string",
                        "description": "The version of the API the event's `data` is written in; also in the `Monotree-Api-Version` header.",
                        "example": "1.0.0"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "sandbox": {
                        "type": "boolean"
                    },
                    "actor": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Actor"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Who did it. Null when nobody in particular did, as for some events that are not about a customer."
                    },
                    "data": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "What the event is about, in the shapes the API returns. For a customer event: `customer` (the whole customer right after the event) and `details`. For a seller event: `seller`, always without `two_factor`, `passkeys` and `last_login_at`. The Event types guide says what each type carries."
                    }
                },
                "example": {
                    "id": "evt_01jcz8wg4h7v3y6n9q2k5m8p1r",
                    "object": "event",
                    "type": "customer.live",
                    "api_version": "1.0.0",
                    "created_at": "2026-11-12T09:42:18Z",
                    "sandbox": false,
                    "actor": {
                        "type": "system",
                        "name": "Monotree"
                    },
                    "data": {
                        "customer": {
                            "id": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                            "object": "customer",
                            "status": "live",
                            "company_name": "Boulangerie Martin",
                            "company_id": "boulangeriemartin",
                            "external_ref": "org_48213"
                        },
                        "details": {
                            "url": "https://boulangeriemartin.monotree.com",
                            "admin_email": "claire@boulangeriemartin.example"
                        }
                    }
                }
            },
            "EventList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Event"
                                }
                            }
                        }
                    }
                ]
            },
            "Statistics": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/StatisticsNumbers"
                    },
                    {
                        "type": "object",
                        "required": [
                            "object",
                            "customer"
                        ],
                        "properties": {
                            "object": {
                                "type": "string",
                                "const": "statistics"
                            },
                            "customer": {
                                "type": "string",
                                "description": "The customer's ID.",
                                "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                            }
                        }
                    }
                ]
            },
            "StatisticsNumbers": {
                "type": "object",
                "required": [
                    "range",
                    "updated_at",
                    "totals",
                    "period",
                    "languages",
                    "daily"
                ],
                "properties": {
                    "range": {
                        "type": "string",
                        "enum": [
                            "7d",
                            "30d",
                            "90d"
                        ],
                        "example": "30d"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "description": "The day (UTC) of the latest numbers. `null` when there are none.",
                        "example": "2026-11-14"
                    },
                    "totals": {
                        "type": "object",
                        "description": "Where things stand on the latest day counted. All `0` when there are no numbers.",
                        "required": [
                            "users",
                            "invited",
                            "active_users_7d",
                            "activation_rate",
                            "weekly_active_rate",
                            "devices",
                            "push_enabled_rate"
                        ],
                        "properties": {
                            "users": {
                                "type": "integer",
                                "description": "Employees registered in the app."
                            },
                            "invited": {
                                "type": "integer",
                                "description": "Employees the customer's admin has invited to the app."
                            },
                            "active_users_7d": {
                                "type": "integer",
                                "description": "Users who opened the app in the last 7 days."
                            },
                            "activation_rate": {
                                "type": "integer",
                                "description": "`users` as a percent of `invited`, rounded. `0` when nobody is invited."
                            },
                            "weekly_active_rate": {
                                "type": "integer",
                                "description": "`active_users_7d` as a percent of `users`, rounded. `0` when there are no users."
                            },
                            "devices": {
                                "type": "object",
                                "description": "Phones with the app, per platform.",
                                "required": [
                                    "ios",
                                    "android"
                                ],
                                "properties": {
                                    "ios": {
                                        "type": "integer"
                                    },
                                    "android": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "push_enabled_rate": {
                                "type": "integer",
                                "description": "Percent of those phones with push notifications on, rounded. `0` when there are no phones."
                            }
                        }
                    },
                    "period": {
                        "type": "object",
                        "description": "Sums over the range.",
                        "required": [
                            "posts",
                            "comments",
                            "reactions",
                            "messages",
                            "user_growth"
                        ],
                        "properties": {
                            "posts": {
                                "type": "integer"
                            },
                            "comments": {
                                "type": "integer"
                            },
                            "reactions": {
                                "type": "integer"
                            },
                            "messages": {
                                "type": "integer"
                            },
                            "user_growth": {
                                "type": [
                                    "number",
                                    "null"
                                ],
                                "description": "Percent change in `users` since the day before the range began, with one decimal. `null` when there were no users or no numbers then.",
                                "example": 3.9
                            }
                        }
                    },
                    "languages": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "integer"
                        },
                        "description": "Users per app language, by language code, the most used first. An empty object (`{}`) when there are no numbers.",
                        "example": {
                            "fr": 7,
                            "en": 1
                        }
                    },
                    "daily": {
                        "type": "array",
                        "description": "One row for each day in the range that has numbers, oldest first.",
                        "items": {
                            "type": "object",
                            "required": [
                                "date",
                                "users",
                                "active_users",
                                "posts",
                                "comments",
                                "reactions",
                                "messages"
                            ],
                            "properties": {
                                "date": {
                                    "type": "string",
                                    "format": "date",
                                    "description": "The day (UTC)."
                                },
                                "users": {
                                    "type": "integer",
                                    "description": "Employees registered in the app on that day."
                                },
                                "active_users": {
                                    "type": "integer",
                                    "description": "Users who opened the app that day."
                                },
                                "posts": {
                                    "type": "integer"
                                },
                                "comments": {
                                    "type": "integer"
                                },
                                "reactions": {
                                    "type": "integer"
                                },
                                "messages": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                }
            },
            "CustomerAdoption": {
                "type": [
                    "object",
                    "null"
                ],
                "description": "The customer's open adoption alert: set while the customer is stalling, `null` otherwise. The same shape wherever a customer carries it. Always in English.",
                "required": [
                    "alert",
                    "reason",
                    "message",
                    "flagged_at"
                ],
                "properties": {
                    "alert": {
                        "type": "string",
                        "description": "The ID of the adoption alert.",
                        "example": "ala_01jd3m5p7r9t1v3x5z7b9d1f3h"
                    },
                    "reason": {
                        "$ref": "#/components/schemas/AdoptionReason"
                    },
                    "message": {
                        "type": "string",
                        "description": "The reason as a sentence, with its numbers.",
                        "example": "Only 19% of invited employees have signed in, 126 days after going live"
                    },
                    "flagged_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the alert was first raised."
                    }
                }
            },
            "SellerRef": {
                "type": [
                    "object",
                    "null"
                ],
                "description": "A seller as another object names one: the seller a customer is credited to, a row of the statement, the person of a sign-in. The same three fields everywhere; the whole seller, with the email address, is [Get a seller](/docs/reference/sellers#get-seller). `null` for a customer made over the API without a `seller_ref`.",
                "required": [
                    "id",
                    "name",
                    "external_ref"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "sel_12"
                    },
                    "name": {
                        "type": "string",
                        "example": "Emma Dubois"
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "usr_20503"
                    }
                }
            },
            "Overview": {
                "type": "object",
                "required": [
                    "object",
                    "month",
                    "complete",
                    "live_customers",
                    "employees",
                    "users",
                    "signed",
                    "cancelled",
                    "sellers",
                    "customers"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "overview"
                    },
                    "month": {
                        "type": "string",
                        "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
                        "example": "2026-10"
                    },
                    "complete": {
                        "type": "boolean",
                        "description": "`true` once the month is over (UTC). `false` for the month that runs: its numbers are as of now and still move."
                    },
                    "live_customers": {
                        "type": "integer",
                        "description": "Customers live at the end of the last day of the month (right now, while the month runs): gone live by then, not cancelled by then and not suspended."
                    },
                    "employees": {
                        "type": "integer",
                        "description": "The employees those customers were signed up with."
                    },
                    "users": {
                        "type": "integer",
                        "description": "Their employees registered in the app, by each customer's latest numbers on or before that day."
                    },
                    "signed": {
                        "type": "integer",
                        "description": "Customers submitted in the month, whether or not they are live."
                    },
                    "cancelled": {
                        "type": "integer",
                        "description": "Customers cancelled in the month that had been live."
                    },
                    "sellers": {
                        "type": "array",
                        "description": "The same numbers per seller, the seller with most live customers first. A seller is listed when they have a customer counted in `live_customers` or signed one in the month.",
                        "items": {
                            "type": "object",
                            "required": [
                                "seller",
                                "customers",
                                "employees",
                                "users",
                                "signed"
                            ],
                            "properties": {
                                "seller": {
                                    "$ref": "#/components/schemas/SellerRef"
                                },
                                "customers": {
                                    "type": "integer",
                                    "description": "Their customers counted in `live_customers`."
                                },
                                "employees": {
                                    "type": "integer",
                                    "description": "The employees those customers were signed up with."
                                },
                                "users": {
                                    "type": "integer",
                                    "description": "Their employees registered in the app."
                                },
                                "signed": {
                                    "type": "integer",
                                    "description": "Customers of this seller submitted in the month."
                                }
                            }
                        }
                    },
                    "customers": {
                        "type": "array",
                        "description": "Every customer counted in `live_customers`, by company name from A to Z. Never paged.",
                        "items": {
                            "type": "object",
                            "required": [
                                "id",
                                "company_name",
                                "company_id",
                                "external_ref",
                                "seller",
                                "live_at",
                                "employees",
                                "users"
                            ],
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                                },
                                "company_name": {
                                    "type": "string",
                                    "example": "Boulangerie Martin"
                                },
                                "company_id": {
                                    "type": "string",
                                    "example": "boulangeriemartin"
                                },
                                "external_ref": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "description": "Your own reference for the customer.",
                                    "example": "org_48213"
                                },
                                "seller": {
                                    "$ref": "#/components/schemas/SellerRef"
                                },
                                "live_at": {
                                    "type": "string",
                                    "format": "date",
                                    "description": "The day (UTC) the customer went live."
                                },
                                "employees": {
                                    "type": "integer",
                                    "description": "The employees the customer was signed up with."
                                },
                                "users": {
                                    "type": "integer",
                                    "description": "Employees registered in the app. `0` when the customer has no numbers yet."
                                }
                            }
                        }
                    }
                }
            },
            "OverviewMonthList": {
                "type": "object",
                "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_cursor"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "list"
                    },
                    "has_more": {
                        "type": "boolean",
                        "const": false,
                        "description": "Always false: the list is never paged."
                    },
                    "next_cursor": {
                        "type": "null",
                        "description": "Always null."
                    },
                    "data": {
                        "type": "array",
                        "description": "Up to twelve months, oldest first.",
                        "items": {
                            "type": "object",
                            "required": [
                                "month",
                                "live_customers",
                                "signed"
                            ],
                            "properties": {
                                "month": {
                                    "type": "string",
                                    "example": "2026-10"
                                },
                                "live_customers": {
                                    "type": "integer",
                                    "description": "Customers live at the end of the month (right now, for the month that runs)."
                                },
                                "signed": {
                                    "type": "integer",
                                    "description": "Customers submitted in the month."
                                }
                            }
                        }
                    }
                }
            },
            "PartnerStatistics": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/StatisticsNumbers"
                    },
                    {
                        "type": "object",
                        "required": [
                            "object",
                            "customers",
                            "employees",
                            "customers_ranked"
                        ],
                        "properties": {
                            "object": {
                                "type": "string",
                                "const": "partner_statistics"
                            },
                            "customers": {
                                "type": "integer",
                                "description": "Live customers counted."
                            },
                            "employees": {
                                "type": "integer",
                                "description": "The employees those customers were signed up with."
                            },
                            "customers_ranked": {
                                "type": "array",
                                "description": "Every live customer, the best taken up first: by `activation_rate` times `weekly_active_rate`, then by `users`. Never paged.",
                                "items": {
                                    "type": "object",
                                    "required": [
                                        "customer",
                                        "company_name",
                                        "company_id",
                                        "external_ref",
                                        "seller",
                                        "employees",
                                        "users",
                                        "activation_rate",
                                        "weekly_active_rate",
                                        "weekly_active_change",
                                        "activity",
                                        "adoption"
                                    ],
                                    "properties": {
                                        "customer": {
                                            "type": "string",
                                            "description": "The customer's ID.",
                                            "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                                        },
                                        "company_name": {
                                            "type": "string",
                                            "example": "Boulangerie Martin"
                                        },
                                        "company_id": {
                                            "type": "string",
                                            "example": "boulangeriemartin"
                                        },
                                        "external_ref": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Your own reference for the customer.",
                                            "example": "org_48213"
                                        },
                                        "seller": {
                                            "$ref": "#/components/schemas/SellerRef"
                                        },
                                        "employees": {
                                            "type": "integer",
                                            "description": "The employees the customer was signed up with."
                                        },
                                        "users": {
                                            "type": "integer",
                                            "description": "Employees registered in the app. `0` until the first numbers."
                                        },
                                        "activation_rate": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "Percent of invited who registered. `null` until the first numbers."
                                        },
                                        "weekly_active_rate": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "Percent of users active in the last 7 days. `null` until the first numbers."
                                        },
                                        "weekly_active_change": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "The weekly active rate now minus the rate on the day before the range began, in percentage points. `null` when the customer had no users or no numbers then."
                                        },
                                        "activity": {
                                            "type": "integer",
                                            "description": "Posts, comments, reactions and messages in the range."
                                        },
                                        "adoption": {
                                            "$ref": "#/components/schemas/CustomerAdoption"
                                        }
                                    }
                                }
                            }
                        }
                    }
                ]
            },
            "Insights": {
                "type": "object",
                "required": [
                    "object",
                    "customer",
                    "range",
                    "live_days",
                    "verdict",
                    "funnel",
                    "comparison",
                    "activity",
                    "weekly_active_rate"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "insights"
                    },
                    "customer": {
                        "type": "string",
                        "description": "The customer's ID.",
                        "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                    },
                    "range": {
                        "type": "string",
                        "enum": [
                            "7d",
                            "30d",
                            "90d"
                        ],
                        "example": "30d"
                    },
                    "live_days": {
                        "type": "integer",
                        "description": "Days since the day the customer went live."
                    },
                    "verdict": {
                        "type": "object",
                        "description": "The first that fits, in the order of the description of `key`.",
                        "required": [
                            "key",
                            "title",
                            "text",
                            "next_step"
                        ],
                        "properties": {
                            "key": {
                                "type": "string",
                                "enum": [
                                    "needs_attention",
                                    "getting_started",
                                    "doing_well",
                                    "on_track"
                                ],
                                "description": "`needs_attention`: the customer is live and has an open adoption alert. `getting_started`: it went live less than 14 days ago. `doing_well`: its weekly active rate is at or above that of your other live customers together. `on_track`: anything else."
                            },
                            "title": {
                                "type": "string",
                                "example": "Doing well"
                            },
                            "text": {
                                "type": "string",
                                "description": "The verdict in a sentence."
                            },
                            "next_step": {
                                "type": "string",
                                "description": "What the seller can do now."
                            }
                        }
                    },
                    "funnel": {
                        "type": "array",
                        "description": "The rollout, step by step, always these four in this order.",
                        "items": {
                            "type": "object",
                            "required": [
                                "key",
                                "label",
                                "value"
                            ],
                            "properties": {
                                "key": {
                                    "type": "string",
                                    "enum": [
                                        "employees",
                                        "invited",
                                        "signed_in",
                                        "active_this_week"
                                    ],
                                    "description": "`employees`: as signed up. `invited`, `signed_in` and `active_this_week` are `invited`, `users` and `active_users_7d` of the statistics."
                                },
                                "label": {
                                    "type": "string"
                                },
                                "value": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "comparison": {
                        "type": "array",
                        "description": "The customer beside your other live customers together, always these four in this order.",
                        "items": {
                            "type": "object",
                            "required": [
                                "key",
                                "label",
                                "value",
                                "average",
                                "unit"
                            ],
                            "properties": {
                                "key": {
                                    "type": "string",
                                    "enum": [
                                        "activation_rate",
                                        "weekly_active_rate",
                                        "activity_per_active_user",
                                        "push_enabled_rate"
                                    ],
                                    "description": "`activity_per_active_user` is posts, comments, reactions and messages a week for each user active in the last 7 days; the others are the rates of the statistics."
                                },
                                "label": {
                                    "type": "string"
                                },
                                "value": {
                                    "type": "number"
                                },
                                "average": {
                                    "type": [
                                        "number",
                                        "null"
                                    ],
                                    "description": "The same number for your other live customers together, without this one. `null` when no other live customer has numbers."
                                },
                                "unit": {
                                    "type": "string",
                                    "enum": [
                                        "percent",
                                        "per_week"
                                    ]
                                }
                            }
                        }
                    },
                    "activity": {
                        "type": "object",
                        "description": "Posts, comments, reactions and messages.",
                        "required": [
                            "now",
                            "before",
                            "change"
                        ],
                        "properties": {
                            "now": {
                                "type": "integer",
                                "description": "In the range."
                            },
                            "before": {
                                "type": "integer",
                                "description": "In the period of the same length before it."
                            },
                            "change": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "description": "Percent change from `before` to `now`. `null` when `before` is `0`."
                            }
                        }
                    },
                    "weekly_active_rate": {
                        "type": "array",
                        "description": "The weekly active rate day by day: one row for each day in the range the customer has numbers for, oldest first.",
                        "items": {
                            "type": "object",
                            "required": [
                                "date",
                                "rate",
                                "average"
                            ],
                            "properties": {
                                "date": {
                                    "type": "string",
                                    "format": "date"
                                },
                                "rate": {
                                    "type": "integer",
                                    "description": "Percent of the customer's users active in the 7 days up to that day."
                                },
                                "average": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "description": "The same for your other live customers together. `null` when none of them has numbers for that day."
                                }
                            }
                        }
                    }
                }
            },
            "AdoptionReason": {
                "type": "string",
                "enum": [
                    "stale",
                    "activation",
                    "drop",
                    "inactive"
                ],
                "description": "`stale`: no numbers for 3 days or more. `activation`: under 30% of the invited employees have registered. `drop`: the weekly active rate fell under half of what it was 4 weeks before. `inactive`: under 20% of the users were active in the last week. See [Statistics and adoption](/docs/statistics) for the exact rules."
            },
            "AdoptionAlert": {
                "type": "object",
                "required": [
                    "id",
                    "object",
                    "customer",
                    "reason",
                    "message",
                    "advice",
                    "flagged_at",
                    "resolved_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "ala_01jd3m5p7r9t1v3x5z7b9d1f3h"
                    },
                    "object": {
                        "type": "string",
                        "const": "adoption_alert"
                    },
                    "customer": {
                        "type": "object",
                        "description": "The customer that stalls.",
                        "required": [
                            "id",
                            "company_name",
                            "external_ref"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "example": "cus_01jd0b2q4m6s8u0w2y4a6c8e0g"
                            },
                            "company_name": {
                                "type": "string",
                                "example": "Librairie Voltaire"
                            },
                            "external_ref": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Your own reference for the customer.",
                                "example": "org_51877"
                            }
                        }
                    },
                    "reason": {
                        "$ref": "#/components/schemas/AdoptionReason"
                    },
                    "message": {
                        "type": "string",
                        "description": "Why, in an English sentence with the numbers of the last check. It may be reworded; build on `reason`.",
                        "example": "Only 19% of invited employees have signed in, 126 days after going live"
                    },
                    "advice": {
                        "type": "string",
                        "description": "What the seller can do about it, in an English sentence.",
                        "example": "Ask Louis Arnaud to invite the team again, or to share the company ID librairievoltaire at the next staff meeting."
                    },
                    "flagged_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the alert was first raised. It does not change when the alert is re-opened."
                    },
                    "resolved_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "`null` while the alert is open."
                    }
                }
            },
            "AdoptionAlertList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/AdoptionAlert"
                                }
                            }
                        }
                    }
                ]
            },
            "Summary": {
                "type": "object",
                "required": [
                    "object",
                    "counts",
                    "live_customers",
                    "employees",
                    "users",
                    "activation_rate",
                    "weekly_active_rate",
                    "low_adoption",
                    "signed_by_month"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "summary"
                    },
                    "counts": {
                        "type": "object",
                        "description": "How many customers are in each status. Deleted customers are not counted.",
                        "required": [
                            "draft",
                            "provisioning",
                            "live",
                            "failed",
                            "suspended",
                            "cancelled"
                        ],
                        "properties": {
                            "draft": {
                                "type": "integer"
                            },
                            "provisioning": {
                                "type": "integer"
                            },
                            "live": {
                                "type": "integer"
                            },
                            "failed": {
                                "type": "integer"
                            },
                            "suspended": {
                                "type": "integer"
                            },
                            "cancelled": {
                                "type": "integer"
                            }
                        }
                    },
                    "live_customers": {
                        "type": "integer",
                        "description": "Customers with the status `live`, the same number as `counts.live`."
                    },
                    "employees": {
                        "type": "integer",
                        "description": "The employees the live customers were signed up with."
                    },
                    "users": {
                        "type": "integer",
                        "description": "Their employees registered in the app, by each customer's latest numbers."
                    },
                    "activation_rate": {
                        "type": "integer",
                        "description": "Percent of invited who registered."
                    },
                    "weekly_active_rate": {
                        "type": "integer",
                        "description": "Percent of users active in the last 7 days."
                    },
                    "low_adoption": {
                        "type": "integer",
                        "description": "Live customers with an open adoption alert."
                    },
                    "signed_by_month": {
                        "type": "array",
                        "description": "Customers submitted in each of the last six months, oldest first and this month last.",
                        "items": {
                            "type": "object",
                            "required": [
                                "month",
                                "signed"
                            ],
                            "properties": {
                                "month": {
                                    "type": "string",
                                    "example": "2026-10"
                                },
                                "signed": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                }
            },
            "Seller": {
                "type": "object",
                "description": "A person at your company, an admin or a seller, with what they brought in. How they sign in (`two_factor`, `passkeys`, `last_login_at`) is only in the answer when the token has the `security:read` ability.",
                "required": [
                    "id",
                    "object",
                    "name",
                    "email",
                    "role",
                    "external_ref",
                    "status",
                    "can_login",
                    "disabled",
                    "adoption_digest",
                    "live_customers",
                    "employees",
                    "signed_this_month",
                    "invited_at",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "sel_5",
                        "description": "Monotree's ID for the person."
                    },
                    "object": {
                        "type": "string",
                        "const": "seller"
                    },
                    "name": {
                        "type": "string",
                        "example": "Emma Dubois"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "emma@acme.example",
                        "description": "Null for a seller known only by your reference."
                    },
                    "role": {
                        "type": "string",
                        "enum": [
                            "admin",
                            "seller"
                        ],
                        "description": "An admin sees every customer of your company and manages people; a seller sees the customers they signed."
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "usr_20503",
                        "description": "Your own ID for the person. Null when you never gave one."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "invited",
                            "api_only",
                            "disabled"
                        ],
                        "example": "active",
                        "description": "`active` has a password and signs in to the portal; `invited` was emailed an invitation and has no password yet; `api_only` is known from the API and has no login; `disabled` can no longer sign in."
                    },
                    "can_login": {
                        "type": "boolean",
                        "description": "Whether the person can sign in to the portal: invited at some time and not disabled. False for `api_only`, for a disabled person and for every test seller."
                    },
                    "disabled": {
                        "type": "boolean",
                        "description": "True when the person was disabled."
                    },
                    "two_factor": {
                        "type": "boolean",
                        "description": "Whether two-factor sign-in is set up. Only present when the token has the `security:read` ability."
                    },
                    "passkeys": {
                        "type": "integer",
                        "example": 0,
                        "description": "How many passkeys they have. Only present when the token has the `security:read` ability."
                    },
                    "adoption_digest": {
                        "type": "boolean",
                        "description": "Whether they get the Monday email about customers that stall."
                    },
                    "live_customers": {
                        "type": "integer",
                        "example": 11,
                        "description": "Customers credited to them that are live or suspended."
                    },
                    "employees": {
                        "type": "integer",
                        "example": 261,
                        "description": "The employees of those customers."
                    },
                    "signed_this_month": {
                        "type": "integer",
                        "example": 1,
                        "description": "Customers of theirs submitted since the first of this month (UTC), whatever became of them."
                    },
                    "invited_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the last invitation was emailed. Null when none was."
                    },
                    "last_login_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Their last sign-in to the portal. Null when they never signed in. Only present when the token has the `security:read` ability."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the person last changed: what `updated_since` filters on. Signing in does not move it."
                    }
                }
            },
            "SellerCreate": {
                "type": "object",
                "required": [
                    "name",
                    "email"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 80,
                        "example": "In\u00e8s Roux"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 120,
                        "example": "ines@acme.example",
                        "description": "Where the invitation goes and what they sign in with. No two people can have the same one."
                    },
                    "role": {
                        "type": "string",
                        "enum": [
                            "admin",
                            "seller"
                        ],
                        "default": "seller",
                        "description": "`admin` also needs the `admins:write` ability."
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 120,
                        "example": "usr_20777",
                        "description": "Your own ID for the person. No two of your sellers can have the same one."
                    },
                    "invite": {
                        "type": "boolean",
                        "default": true,
                        "description": "Email an invitation to the portal. With `false` the seller has no login (`api_only`) until you invite them. Never sent with a sandbox token."
                    },
                    "adoption_digest": {
                        "type": "boolean",
                        "default": true,
                        "description": "`false` turns the Monday email about stalling customers off for them."
                    }
                }
            },
            "SellerUpdate": {
                "type": "object",
                "description": "Send only the fields to change.",
                "properties": {
                    "name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 80,
                        "example": "In\u00e8s Roux"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 120,
                        "example": "ines@acme.example",
                        "description": "Changing it makes an invitation link sent earlier stop working. For an admin it also needs `admins:write`."
                    },
                    "role": {
                        "type": "string",
                        "enum": [
                            "admin",
                            "seller"
                        ],
                        "description": "Also needs `admins:write`, to make someone an admin or to make an admin a seller."
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 120,
                        "example": "usr_20777",
                        "description": "`null` removes it. Changing or removing the reference of a seller who has customers, signs in or is invited also needs `admins:write`."
                    },
                    "invite": {
                        "type": "boolean",
                        "description": "`true` emails an invitation to someone who has no password yet. They need an email address, which may come in the same call. Someone who has a password answers `409 already_active`, as Invite a seller does. Never sent with a sandbox token."
                    },
                    "disabled": {
                        "type": "boolean",
                        "description": "`true` signs the person out and keeps them out; `false` lets them back in. For an admin it also needs `admins:write`."
                    },
                    "adoption_digest": {
                        "type": "boolean",
                        "description": "`false` turns the Monday email about stalling customers off for them."
                    }
                }
            },
            "SellerList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Seller"
                                }
                            }
                        }
                    }
                ]
            },
            "SecurityPerson": {
                "type": "object",
                "description": "How one of your people signs in to the portal.",
                "required": [
                    "object",
                    "seller",
                    "email",
                    "role",
                    "two_factor",
                    "passkeys",
                    "last_sign_in",
                    "failed_7d",
                    "dormant"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "security_person"
                    },
                    "seller": {
                        "$ref": "#/components/schemas/SellerRef"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "emma@acme.example",
                        "description": "The address they sign in with."
                    },
                    "role": {
                        "type": "string",
                        "enum": [
                            "admin",
                            "seller"
                        ]
                    },
                    "two_factor": {
                        "type": "boolean",
                        "description": "Whether two-factor sign-in is set up."
                    },
                    "passkeys": {
                        "type": "integer",
                        "example": 0,
                        "description": "How many passkeys they have."
                    },
                    "last_sign_in": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Null for someone who never signed in.",
                        "required": [
                            "at",
                            "device",
                            "ip",
                            "via"
                        ],
                        "properties": {
                            "at": {
                                "type": "string",
                                "format": "date-time"
                            },
                            "device": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "Chrome on macOS",
                                "description": "The browser and system. Null when the sign-in is older than the sign-in log (180 days)."
                            },
                            "ip": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "203.0.113.7",
                                "description": "Null when the sign-in is older than the sign-in log."
                            },
                            "via": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "password",
                                    "passkey",
                                    null
                                ],
                                "description": "How they signed in. Null when the sign-in is older than the sign-in log."
                            }
                        }
                    },
                    "failed_7d": {
                        "type": "integer",
                        "example": 0,
                        "description": "Wrong passwords, wrong two-factor codes and lockouts in the last 7 days."
                    },
                    "dormant": {
                        "type": "boolean",
                        "description": "No sign-in for 90 days or more. For someone who never signed in, counted from the day they were added."
                    }
                }
            },
            "SecurityPersonList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SecurityPerson"
                                }
                            }
                        }
                    }
                ]
            },
            "SecurityEvent": {
                "type": "object",
                "description": "One line of the sign-in log.",
                "required": [
                    "id",
                    "object",
                    "type",
                    "label",
                    "denied",
                    "seller",
                    "device",
                    "ip",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "sev_812"
                    },
                    "object": {
                        "type": "string",
                        "const": "security_event"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "login",
                            "logout",
                            "login.failed",
                            "login.lockout",
                            "password.reset",
                            "password.changed",
                            "two_factor.failed",
                            "two_factor.enabled",
                            "two_factor.confirmed",
                            "two_factor.disabled",
                            "two_factor.reset",
                            "two_factor.recovery_code_used",
                            "two_factor.recovery_codes_generated",
                            "passkey.added",
                            "passkey.removed"
                        ],
                        "example": "login.failed",
                        "description": "What happened. See [Security and sign-in](/docs/security#sign-in-log) for what each one means."
                    },
                    "label": {
                        "type": "string",
                        "example": "Wrong password",
                        "description": "The type as an English sentence for a person. It may change; act on `type`."
                    },
                    "denied": {
                        "type": "boolean",
                        "description": "An attempt that did not get in: `login.failed`, `login.lockout` or `two_factor.failed`."
                    },
                    "seller": {
                        "$ref": "#/components/schemas/SellerRef"
                    },
                    "device": {
                        "type": "string",
                        "example": "Chrome on macOS",
                        "description": "The browser and system it came from, or `Unknown device`."
                    },
                    "ip": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "203.0.113.7",
                        "description": "The address it came from."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "SecurityEventList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SecurityEvent"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportThread": {
                "type": "object",
                "description": "A support thread: one matter with one person at a customer. In a list and in events it comes without `messages`, `has_earlier_messages`, `notes`, `history`, `escalations` and `draft`.",
                "required": [
                    "id",
                    "object",
                    "channel",
                    "status",
                    "view",
                    "priority",
                    "kind",
                    "subject",
                    "summary",
                    "preview",
                    "language",
                    "unread",
                    "customer",
                    "person",
                    "assignee",
                    "tags",
                    "cc",
                    "signed",
                    "needs_person",
                    "no_reply_needed",
                    "snoozed_until",
                    "resolution",
                    "dismissed_reason",
                    "rating",
                    "rated_at",
                    "reopened_count",
                    "message_count",
                    "started_at",
                    "waiting_since",
                    "first_response_at",
                    "last_message_at",
                    "closed_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "sth_01m7d1ajq9w7ak2vnnp8hfdwj8"
                    },
                    "object": {
                        "type": "string",
                        "const": "support_thread"
                    },
                    "channel": {
                        "type": "string",
                        "enum": [
                            "chat",
                            "email"
                        ],
                        "description": "`chat`: their Support room in the Monotree app. `email`: mail to your support address."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "open",
                            "waiting",
                            "closed",
                            "dismissed"
                        ],
                        "description": "`open` waits for you, `waiting` waits for the customer. `closed` is done; `dismissed` was never one to answer (spam, a mistake, an automatic mail)."
                    },
                    "view": {
                        "type": "string",
                        "enum": [
                            "open",
                            "waiting",
                            "snoozed",
                            "closed",
                            "dismissed"
                        ],
                        "description": "Where the Support page shows it: the `status`, or `snoozed` for an open or waiting thread put aside until `snoozed_until`. Never `followup`: a thread under that view keeps its own `view` here."
                    },
                    "priority": {
                        "type": "string",
                        "enum": [
                            "urgent",
                            "high",
                            "normal",
                            "low"
                        ],
                        "description": "How pressing it is. `normal` until the assistant reads the thread or you set it; what you set stays."
                    },
                    "kind": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "question",
                            "bug",
                            "feature_request",
                            "other",
                            null
                        ],
                        "description": "What the thread is. The assistant sets it when it reads the thread; what you set stays. Null until then."
                    },
                    "subject": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The subject of a mail. Null for a chat."
                    },
                    "summary": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "What it is about, in a line, as the assistant read it."
                    },
                    "preview": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The start of their last message, up to 190 characters."
                    },
                    "language": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The language they write in, as the assistant read it.",
                        "example": "fr"
                    },
                    "unread": {
                        "type": "boolean",
                        "description": "The thread is open and they have written since it was last marked read: by one of your people opening it in the portal, or by you sending `unread: false`."
                    },
                    "customer": {
                        "$ref": "#/components/schemas/SupportCustomerRef"
                    },
                    "person": {
                        "$ref": "#/components/schemas/SupportPerson"
                    },
                    "assignee": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Which of your people has the thread. Null for nobody. The first of your people to answer in the portal gets it; an answer over the API assigns nobody.",
                        "required": [
                            "id",
                            "name"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "example": "sel_5"
                            },
                            "name": {
                                "type": "string",
                                "example": "Emma Dubois"
                            }
                        }
                    },
                    "tags": {
                        "type": "array",
                        "description": "The product areas the thread is about.",
                        "items": {
                            "$ref": "#/components/schemas/SupportTagRef"
                        }
                    },
                    "cc": {
                        "type": "array",
                        "description": "Who else gets your answers to a mail. Empty for a chat.",
                        "items": {
                            "type": "object",
                            "required": [
                                "name",
                                "email"
                            ],
                            "properties": {
                                "name": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "email": {
                                    "type": "string",
                                    "format": "email"
                                }
                            }
                        }
                    },
                    "signed": {
                        "type": "boolean",
                        "description": "Whether your answers in this thread end with the first name of the person who wrote them. Follows the desk's `signature` setting for a chat and is always true for a mail, unless set on the thread."
                    },
                    "needs_person": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Set where the assistant, with `auto` on `sends`, did not send its draft and one of your people must look. Cleared when one of you answers.",
                        "required": [
                            "since",
                            "reason"
                        ],
                        "properties": {
                            "since": {
                                "type": "string",
                                "format": "date-time"
                            },
                            "reason": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Why, in a sentence for your people."
                            }
                        }
                    },
                    "no_reply_needed": {
                        "type": "boolean",
                        "description": "The assistant read their last message as one that needs no answer (a thank-you, say)."
                    },
                    "snoozed_until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Until when the thread is put aside. Null when it is not, or when the time has passed."
                    },
                    "resolution": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "How a closed thread ended: `answered`, `no_reply` (there was nothing to answer), `no_response` (they went quiet), `outreach` (a message of yours to many people, sent from the portal). Null while it is open or waiting.",
                        "example": "answered"
                    },
                    "dismissed_reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Why it was dismissed: `staff` (by hand, no reason given), `spam`, `mistake`, `duplicate`, `api` (over the API, no reason given); or by the desk itself, `auto` (an automatic mail) or `deleted` (they took the message back)."
                    },
                    "rating": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "positive",
                            "negative",
                            null
                        ],
                        "description": "Whether your answer helped, as the customer said when the chat was closed."
                    },
                    "rated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "reopened_count": {
                        "type": "integer",
                        "description": "How many times it was closed or dismissed and opened again."
                    },
                    "message_count": {
                        "type": "integer",
                        "description": "Their messages and yours together, the automatic reply included."
                    },
                    "started_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "waiting_since": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Since when their oldest unanswered message has waited. Null when nothing waits for you."
                    },
                    "first_response_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When their first message was first answered. The automatic reply does not count."
                    },
                    "last_message_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the last message was written in it. The list is ordered by this."
                    },
                    "closed_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When it was closed or dismissed."
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "messages": {
                        "type": "array",
                        "description": "Only on a single thread: its latest 50 messages, oldest first.",
                        "items": {
                            "$ref": "#/components/schemas/SupportMessage"
                        }
                    },
                    "has_earlier_messages": {
                        "type": "boolean",
                        "description": "Only on a single thread: there are messages before the ones in `messages`."
                    },
                    "notes": {
                        "type": "array",
                        "description": "Only on a single thread: the notes of your people, oldest first.",
                        "items": {
                            "$ref": "#/components/schemas/SupportNote"
                        }
                    },
                    "history": {
                        "type": "array",
                        "description": "Only on a single thread: who did what, when, oldest first.",
                        "items": {
                            "$ref": "#/components/schemas/SupportHistoryEntry"
                        }
                    },
                    "escalations": {
                        "type": "array",
                        "description": "Only on a single thread: what was handed on to Monotree from it.",
                        "items": {
                            "$ref": "#/components/schemas/SupportThreadEscalation"
                        }
                    },
                    "draft": {
                        "description": "Only on a single thread: the assistant's latest draft for it, or null where it never drafted. It can be one that was used or put aside already: only a draft with `status: ready` and `outcome: null` still waits for you.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SupportDraft"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                },
                "example": {
                    "id": "sth_01m7d1ajq9w7ak2vnnp8hfdwj8",
                    "object": "support_thread",
                    "channel": "chat",
                    "status": "waiting",
                    "view": "waiting",
                    "priority": "high",
                    "kind": "bug",
                    "subject": null,
                    "summary": null,
                    "preview": "Bonjour, mon invitation ne marche pas.",
                    "language": "fr",
                    "unread": false,
                    "customer": {
                        "id": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                        "company_name": "Boulangerie Martin",
                        "external_ref": "org_48213"
                    },
                    "person": {
                        "id": "per_132",
                        "object": "support_person",
                        "name": "Sophie Garnier",
                        "email": "sophie@boulangeriemartin.example",
                        "phone": null,
                        "role": "Manager",
                        "title": null,
                        "locale": "fr",
                        "timezone": null,
                        "departments": [],
                        "device": null,
                        "last_active_on": null,
                        "verified": true,
                        "chat": true,
                        "customer": null
                    },
                    "assignee": {
                        "id": "sel_5",
                        "name": "Emma Dubois"
                    },
                    "tags": [
                        {
                            "id": 1,
                            "name": "Invitations",
                            "color": "#0e7490"
                        }
                    ],
                    "cc": [],
                    "signed": true,
                    "needs_person": null,
                    "no_reply_needed": false,
                    "snoozed_until": null,
                    "resolution": null,
                    "dismissed_reason": null,
                    "rating": null,
                    "rated_at": null,
                    "reopened_count": 0,
                    "message_count": 2,
                    "started_at": "2026-11-14T12:43:10Z",
                    "waiting_since": null,
                    "first_response_at": "2026-11-14T12:43:21Z",
                    "last_message_at": "2026-11-14T12:43:21Z",
                    "closed_at": null,
                    "updated_at": "2026-11-14T12:44:09Z",
                    "messages": [
                        {
                            "id": "msg_01m7d1ajqgwbvenrpw7gz6xn25",
                            "object": "support_message",
                            "direction": "in",
                            "kind": "message",
                            "author": {
                                "type": "customer",
                                "name": "Sophie Garnier"
                            },
                            "body": "Bonjour, mon invitation ne marche pas.",
                            "edited": false,
                            "deleted": false,
                            "attachments": [],
                            "delivery": null,
                            "send_state": null,
                            "sent_at": "2026-11-14T12:43:10Z",
                            "delivered_at": null
                        },
                        {
                            "id": "msg_01m7d1awpxds8kqrrt6733j0d2",
                            "object": "support_message",
                            "direction": "out",
                            "kind": "message",
                            "author": {
                                "type": "api",
                                "name": "API \u00b7 Back office, production"
                            },
                            "body": "Bonjour Sophie, voici le guide.",
                            "edited": false,
                            "deleted": false,
                            "attachments": [
                                {
                                    "id": "att_2",
                                    "name": "guide.pdf",
                                    "mime": "application/pdf",
                                    "size": 48213,
                                    "url": "https://partners.monotree.com/api/v1/support/attachments/att_2"
                                }
                            ],
                            "delivery": {
                                "state": "delivered",
                                "error": null,
                                "delivered_at": "2026-11-14T12:43:21Z"
                            },
                            "send_state": "sent",
                            "sent_at": "2026-11-14T12:43:21Z",
                            "delivered_at": "2026-11-14T12:43:21Z"
                        }
                    ],
                    "has_earlier_messages": false,
                    "notes": [
                        {
                            "id": "note_2",
                            "object": "support_note",
                            "author": {
                                "type": "api",
                                "name": "API \u00b7 Back office, production"
                            },
                            "body": "Called the manager; she will try again on Monday.",
                            "created_at": "2026-11-14T12:43:20Z"
                        }
                    ],
                    "history": [
                        {
                            "type": "opened",
                            "by": null,
                            "details": null,
                            "at": "2026-11-14T12:43:10Z"
                        },
                        {
                            "type": "assigned",
                            "by": "API \u00b7 Back office, production",
                            "details": {
                                "assignee": "Emma Dubois"
                            },
                            "at": "2026-11-14T12:44:09Z"
                        }
                    ],
                    "escalations": [
                        {
                            "id": "esc_01m7d1cbwj6agthjesfk7198t7",
                            "title": "Invitation link opens a blank page",
                            "category": "bug",
                            "status": "sent",
                            "relation": "created",
                            "released_in": null,
                            "follow_up_due": false,
                            "followed_up_at": null,
                            "follow_up_outcome": null
                        }
                    ],
                    "draft": {
                        "id": "drf_227",
                        "object": "support_draft",
                        "status": "ready",
                        "round": 1,
                        "version": 1,
                        "trigger": "new",
                        "stale": false,
                        "body": "Bonjour Sophie,\n\nMerci pour votre message.\n\nEssayez d'abord de vous d\u00e9connecter puis de vous reconnecter, et v\u00e9rifiez que l'application Monotree est \u00e0 jour.",
                        "language": "fr",
                        "summary": null,
                        "kind": "bug",
                        "no_reply_needed": false,
                        "confidence": "medium",
                        "recommendation": {
                            "action": "create_ticket",
                            "label": "Escalate to Monotree",
                            "text": "This sounds like a fault in the app rather than a question. Send the first steps, and escalate it to Monotree if they do not help.",
                            "unverified": [
                                "Whether it happens on every phone or only one kind."
                            ]
                        },
                        "questions": [],
                        "answers": [],
                        "note": null,
                        "escalation": null,
                        "sources": [],
                        "error": null,
                        "outcome": "superseded",
                        "created_at": "2026-11-14T12:43:10Z",
                        "finished_at": "2026-11-14T12:43:10Z"
                    }
                }
            },
            "SupportCustomerRef": {
                "type": [
                    "object",
                    "null"
                ],
                "description": "The customer the person belongs to. Null for a mail from a sender nobody has tied to a customer yet (live only).",
                "required": [
                    "id",
                    "company_name",
                    "external_ref"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                    },
                    "company_name": {
                        "type": "string",
                        "example": "Boulangerie Martin"
                    },
                    "external_ref": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Your own reference for the customer.",
                        "example": "org_48213"
                    }
                }
            },
            "SupportHistoryEntry": {
                "type": "object",
                "description": "One line of a thread's history.",
                "required": [
                    "type",
                    "by",
                    "details",
                    "at"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "description": "What happened. An open list: `opened` (they wrote first), `started` (you wrote first), `closed`, `dismissed`, `reopened`, `assigned`, `priority`, `snoozed`, `woken`, `matched` (the sender was tied to a customer), `merged`, `escalation` (escalated to Monotree), `followed_up`, `rated`, `urgent`, `human` (the assistant left it to a person), `auto_sent` (the assistant sent its draft).",
                        "example": "closed"
                    },
                    "by": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The person, or `API \u00b7 ` and the name of the token. Null where the desk or the customer did it.",
                        "example": "API \u00b7 Back office, production"
                    },
                    "details": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "More about it, by type: `resolution` for `closed`, `reason` for `dismissed`, `assignee` (a name, or null) for `assigned`, `priority`, `until` for `snoozed`, `customer` (a name) for `matched`, `from` (the thread that is gone) for `merged`, `escalation` (its ID) and `relation` for `escalation`, `escalation` and `outcome` for `followed_up`, `score` for `rated`, `assistant` (its name) for `auto_sent`, `reason` and `assistant` for `human`. Other keys may be there; do not build on them.",
                        "additionalProperties": true,
                        "example": {
                            "resolution": "answered"
                        }
                    },
                    "at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "SupportThreadEscalation": {
                "type": "object",
                "description": "An escalation as a thread it came from sees it.",
                "required": [
                    "id",
                    "title",
                    "category",
                    "status",
                    "relation",
                    "released_in",
                    "follow_up_due",
                    "followed_up_at",
                    "follow_up_outcome"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "esc_01m7d1cbwj6agthjesfk7198t7"
                    },
                    "title": {
                        "type": "string",
                        "example": "Invitation link opens a blank page"
                    },
                    "category": {
                        "type": "string",
                        "enum": [
                            "bug",
                            "feature_request",
                            "investigation"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "sent",
                            "received",
                            "fixed",
                            "released",
                            "declined"
                        ]
                    },
                    "relation": {
                        "type": "string",
                        "enum": [
                            "created",
                            "duplicate"
                        ],
                        "description": "Whether the escalation was made from this thread, or the thread was added to it."
                    },
                    "released_in": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The release it shipped in, as Monotree names it.",
                        "example": "App 4.17"
                    },
                    "follow_up_due": {
                        "type": "boolean",
                        "description": "It was released and nobody has followed up on this thread."
                    },
                    "followed_up_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "follow_up_outcome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "told",
                            "no_need",
                            null
                        ],
                        "description": "`told`: the customer was told. `no_need`: nobody needed telling."
                    }
                }
            },
            "SupportPerson": {
                "type": "object",
                "description": "Someone at a customer who wrote to support, or was written to, with what Monotree knows of them.",
                "required": [
                    "id",
                    "object",
                    "name",
                    "email",
                    "phone",
                    "role",
                    "title",
                    "locale",
                    "timezone",
                    "departments",
                    "device",
                    "last_active_on",
                    "verified",
                    "chat",
                    "admin",
                    "customer"
                ],
                "properties": {
                    "id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "per_132",
                        "description": "Null in [List people](/docs/reference/support-threads#list-support-people) for a customer's invited admin who has not written and has not been written to yet: start a thread by mail with their `email`."
                    },
                    "object": {
                        "type": "string",
                        "const": "support_person"
                    },
                    "name": {
                        "type": "string",
                        "example": "Sophie Garnier"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "sophie@boulangeriemartin.example"
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "role": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Their role in their company's Monotree.",
                        "example": "Manager"
                    },
                    "title": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Their job title."
                    },
                    "locale": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The language of their app.",
                        "example": "fr"
                    },
                    "timezone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "Europe/Paris"
                    },
                    "departments": {
                        "type": "array",
                        "description": "The names of their departments.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "device": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "The phone they last used the app on, where known.",
                        "required": [
                            "platform",
                            "model",
                            "os",
                            "app_version"
                        ],
                        "properties": {
                            "platform": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "ios"
                            },
                            "model": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "iPhone 15"
                            },
                            "os": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "iOS 18.6"
                            },
                            "app_version": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "4.16.2"
                            }
                        }
                    },
                    "last_active_on": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "description": "The day they last used the app."
                    },
                    "verified": {
                        "type": "boolean",
                        "description": "Monotree knows the sender is who they say."
                    },
                    "chat": {
                        "type": "boolean",
                        "description": "They have a Support room in the app and can be written to by chat."
                    },
                    "admin": {
                        "type": "boolean",
                        "description": "They are the admin Monotree invited at their company, who can always be written to by mail. Told in [List people](/docs/reference/support-threads#list-support-people); false on a thread."
                    },
                    "customer": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Their company. Filled in [List people](/docs/reference/support-threads#list-support-people) only; null on a thread, which has its own `customer`.",
                        "required": [
                            "id",
                            "company_name"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "example": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8"
                            },
                            "company_name": {
                                "type": "string",
                                "example": "Boulangerie Martin"
                            }
                        }
                    }
                },
                "example": {
                    "id": "per_132",
                    "object": "support_person",
                    "name": "Sophie Garnier",
                    "email": "sophie@boulangeriemartin.example",
                    "phone": null,
                    "role": "Manager",
                    "title": null,
                    "locale": "fr",
                    "timezone": null,
                    "departments": [],
                    "device": null,
                    "last_active_on": null,
                    "verified": true,
                    "chat": true,
                    "customer": null
                }
            },
            "SupportPersonList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SupportPerson"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportTag": {
                "type": "object",
                "description": "A product area of the Monotree app that a thread can be tagged with.",
                "required": [
                    "id",
                    "object",
                    "name",
                    "color"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "object": {
                        "type": "string",
                        "const": "support_tag"
                    },
                    "name": {
                        "type": "string",
                        "example": "Invitations"
                    },
                    "color": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The colour the portal shows it in.",
                        "example": "#0e7490"
                    }
                }
            },
            "SupportTagList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SupportTag"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportTagRef": {
                "type": "object",
                "description": "A tag on a thread.",
                "required": [
                    "id",
                    "name",
                    "color"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "name": {
                        "type": "string",
                        "example": "Invitations"
                    },
                    "color": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "example": "#0e7490"
                    }
                }
            },
            "SupportAttachment": {
                "type": "object",
                "description": "A file that came or went with a message.",
                "required": [
                    "id",
                    "name",
                    "mime",
                    "size",
                    "url"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "att_2"
                    },
                    "name": {
                        "type": "string",
                        "example": "guide.pdf"
                    },
                    "mime": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Its media type, as read from the file.",
                        "example": "application/pdf"
                    },
                    "size": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "In bytes.",
                        "example": 48213
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Where the file is. For a file sent with one of your answers this is [Download an attachment](/docs/reference/support-messages#get-support-attachment): fetch it with your token. For a file the customer sent it is the address Monotree keeps it at.",
                        "example": "https://partners.monotree.com/api/v1/support/attachments/att_2"
                    }
                }
            },
            "SupportMessage": {
                "type": "object",
                "description": "One message in a thread: theirs (`direction: in`) or an answer from your desk (`out`).",
                "required": [
                    "id",
                    "object",
                    "direction",
                    "kind",
                    "author",
                    "body",
                    "edited",
                    "deleted",
                    "attachments",
                    "delivery",
                    "send_state",
                    "sent_at",
                    "delivered_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "msg_01m7d1awpxds8kqrrt6733j0d2"
                    },
                    "object": {
                        "type": "string",
                        "const": "support_message"
                    },
                    "direction": {
                        "type": "string",
                        "enum": [
                            "in",
                            "out"
                        ],
                        "description": "`in`: theirs. `out`: from your desk."
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "message",
                            "auto"
                        ],
                        "description": "`auto`: the automatic reply sent while the desk was offline. It does not count as an answer."
                    },
                    "author": {
                        "type": "object",
                        "required": [
                            "type",
                            "name"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "customer",
                                    "seller",
                                    "api",
                                    "assistant",
                                    "system"
                                ],
                                "description": "`customer`: someone at the customer. `seller`: one of your people, in the portal. `api`: a token of yours. `assistant`: the assistant sending its own draft (`auto` on `sends`). `system`: the desk itself (the automatic reply)."
                            },
                            "name": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "The person's name; `API \u00b7 ` and the token's name; the name the assistant goes by; or `Support` for the desk.",
                                "example": "Sophie Garnier"
                            }
                        }
                    },
                    "body": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The text, as plain text. Null where they took the message back."
                    },
                    "edited": {
                        "type": "boolean",
                        "description": "They changed the message after sending it."
                    },
                    "deleted": {
                        "type": "boolean",
                        "description": "They took the message back. Its `body` is then null and its `attachments` empty."
                    },
                    "attachments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/SupportAttachment"
                        }
                    },
                    "delivery": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "How far an answer got. Null on their messages.",
                        "required": [
                            "state",
                            "error",
                            "delivered_at"
                        ],
                        "properties": {
                            "state": {
                                "type": "string",
                                "enum": [
                                    "sending",
                                    "sent",
                                    "delivered",
                                    "failed"
                                ],
                                "description": "`sending`: on its way to Monotree. `sent`: with Monotree. `delivered`: it reached them. `failed`: it could not be delivered; see `error` and [send it again](/docs/reference/support-messages#retry-support-message)."
                            },
                            "error": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Why it failed. Null unless `state` is `failed`."
                            },
                            "delivered_at": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    },
                    "send_state": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "sending",
                            "sent",
                            "failed",
                            null
                        ],
                        "deprecated": true,
                        "description": "Older than `delivery`, kept for now: use `delivery.state`. Null on their messages."
                    },
                    "sent_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When it was written. Messages are ordered by this."
                    },
                    "delivered_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "deprecated": true,
                        "description": "The same as `delivery.delivered_at`: use that."
                    }
                },
                "example": {
                    "id": "msg_01m7d1awpxds8kqrrt6733j0d2",
                    "object": "support_message",
                    "direction": "out",
                    "kind": "message",
                    "author": {
                        "type": "api",
                        "name": "API \u00b7 Back office, production"
                    },
                    "body": "Bonjour Sophie, voici le guide.",
                    "edited": false,
                    "deleted": false,
                    "attachments": [
                        {
                            "id": "att_2",
                            "name": "guide.pdf",
                            "mime": "application/pdf",
                            "size": 48213,
                            "url": "https://partners.monotree.com/api/v1/support/attachments/att_2"
                        }
                    ],
                    "delivery": {
                        "state": "delivered",
                        "error": null,
                        "delivered_at": "2026-11-14T12:43:21Z"
                    },
                    "send_state": "sent",
                    "sent_at": "2026-11-14T12:43:21Z",
                    "delivered_at": "2026-11-14T12:43:21Z"
                }
            },
            "SupportMessageList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SupportMessage"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportNote": {
                "type": "object",
                "description": "A note on a thread, for your own people only.",
                "required": [
                    "id",
                    "object",
                    "author",
                    "body",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "note_2"
                    },
                    "object": {
                        "type": "string",
                        "const": "support_note"
                    },
                    "author": {
                        "type": "object",
                        "required": [
                            "type",
                            "name"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "seller",
                                    "api"
                                ],
                                "description": "`seller`: one of your people, in the portal. `api`: a token of yours."
                            },
                            "name": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "example": "API \u00b7 Back office, production"
                            }
                        }
                    },
                    "body": {
                        "type": "string",
                        "example": "Called the manager; she will try again on Monday."
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "example": {
                    "id": "note_2",
                    "object": "support_note",
                    "author": {
                        "type": "api",
                        "name": "API \u00b7 Back office, production"
                    },
                    "body": "Called the manager; she will try again on Monday.",
                    "created_at": "2026-11-14T12:43:20Z"
                }
            },
            "SupportNoteCreate": {
                "type": "object",
                "required": [
                    "body"
                ],
                "properties": {
                    "body": {
                        "type": "string",
                        "maxLength": 10000,
                        "description": "The note, as plain text.",
                        "example": "Called the manager; she will try again on Monday."
                    }
                }
            },
            "SupportMerge": {
                "type": "object",
                "required": [
                    "into"
                ],
                "properties": {
                    "into": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "The thread that stays: another thread of the same person.",
                        "example": "sth_01m7d1eq5nqnr07hphj298061a"
                    }
                }
            },
            "SupportThreadList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SupportThread"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportReply": {
                "type": "object",
                "description": "An answer. Send `body`, `attachments`, or both.",
                "properties": {
                    "body": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 10000,
                        "description": "The answer, as plain text. Needed unless there are attachments.",
                        "example": "Bonjour Sophie, voici le guide."
                    },
                    "attachments": {
                        "type": "array",
                        "maxItems": 8,
                        "description": "Files to send with the answer. All the files of one answer are together at most 25 MB before encoding. Each is an object with `name` and `content` only; any other field is refused.",
                        "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "name",
                                "content"
                            ],
                            "properties": {
                                "name": {
                                    "type": "string",
                                    "maxLength": 200,
                                    "description": "The file's name as the customer sees it.",
                                    "example": "guide.pdf"
                                },
                                "content": {
                                    "type": "string",
                                    "description": "The file's bytes, base64 encoded (the standard alphabet).",
                                    "example": "JVBERi0xLjQK"
                                }
                            }
                        }
                    },
                    "last_seen_message": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "The latest message of theirs (`direction: in`) you have read. Where that is not their latest message any more, nothing is sent (409 `invalid_state`).",
                        "example": "msg_01m7d1ajqgwbvenrpw7gz6xn25"
                    }
                }
            },
            "SupportThreadStart": {
                "type": "object",
                "required": [
                    "channel",
                    "body"
                ],
                "properties": {
                    "channel": {
                        "type": "string",
                        "enum": [
                            "chat",
                            "email"
                        ],
                        "description": "How to write: to their Support room, or by mail."
                    },
                    "customer": {
                        "type": "string",
                        "maxLength": 140,
                        "description": "The customer: its ID, or `external_ref:` and your own reference. Needed for `chat`. For `email` it says whose the address is, and is needed with a sandbox token; it does not make an unknown address allowed.",
                        "example": "external_ref:org_48213"
                    },
                    "person": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "Needed for `chat`: who to write to, from [List people](/docs/reference/support-threads#list-support-people).",
                        "example": "per_132"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 250,
                        "description": "Needed for `email`: the address to write to. It must be someone who has written before, the admin email of one of your customers, or an address at that admin's own mail domain (not a public mail domain); otherwise the call answers 409.",
                        "example": "claire@boulangeriemartin.example"
                    },
                    "name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 250,
                        "description": "For `email`: their name, used where the address is new.",
                        "example": "Claire Martin"
                    },
                    "subject": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 250,
                        "description": "For `email`: the subject of the mail.",
                        "example": "Votre nouvel espace"
                    },
                    "body": {
                        "type": "string",
                        "maxLength": 10000,
                        "description": "Your message, as plain text.",
                        "example": "Bonjour Sophie, tout va bien ?"
                    }
                }
            },
            "SupportSimulate": {
                "type": "object",
                "required": [
                    "customer",
                    "channel",
                    "name",
                    "body"
                ],
                "properties": {
                    "customer": {
                        "type": "string",
                        "maxLength": 140,
                        "description": "A sandbox customer: its ID, or `external_ref:` and your own reference.",
                        "example": "external_ref:org_48213"
                    },
                    "channel": {
                        "type": "string",
                        "enum": [
                            "chat",
                            "email"
                        ]
                    },
                    "name": {
                        "type": "string",
                        "maxLength": 250,
                        "description": "Who writes. The same `email` again (or, without one, the same name) is the same person.",
                        "example": "Sophie Garnier"
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "maxLength": 250,
                        "description": "Their address. Needed for `email`.",
                        "example": "sophie@boulangeriemartin.example"
                    },
                    "role": {
                        "type": "string",
                        "enum": [
                            "Super admin",
                            "Admin",
                            "Editor",
                            "Manager",
                            "Manager | Editor"
                        ],
                        "default": "Admin",
                        "description": "Their role in their company's Monotree."
                    },
                    "subject": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 250,
                        "description": "For `email`: the subject of a new thread."
                    },
                    "body": {
                        "type": "string",
                        "maxLength": 10000,
                        "description": "What they write. The sandbox assistant reads a few words: `bug`, `error` or `ne marche pas` make it a bug with a proposed escalation, `nobody` or `personne ne` make it urgent, and a bare `Thanks` or `Merci` needs no reply.",
                        "example": "Bonjour, mon invitation ne marche pas."
                    }
                }
            },
            "SupportThreadUpdate": {
                "type": "object",
                "description": "Send only what changes.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "open",
                            "closed",
                            "dismissed"
                        ],
                        "description": "`closed` closes an open or waiting thread as `answered`. `dismissed` dismisses it. `open` reopens a closed or dismissed thread. A thread becomes `waiting` only by an answer."
                    },
                    "reason": {
                        "type": "string",
                        "enum": [
                            "staff",
                            "spam",
                            "mistake",
                            "duplicate",
                            "api"
                        ],
                        "default": "api",
                        "description": "With `status: dismissed`: why."
                    },
                    "assignee": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 140,
                        "example": "sel_5",
                        "description": "One of your people (`sel_\u2026`, or `external_ref:` and your reference for them), or null for nobody. With a sandbox token, a test seller."
                    },
                    "priority": {
                        "type": "string",
                        "enum": [
                            "urgent",
                            "high",
                            "normal",
                            "low"
                        ]
                    },
                    "kind": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "question",
                            "bug",
                            "feature_request",
                            "other",
                            null
                        ]
                    },
                    "tags": {
                        "type": "array",
                        "maxItems": 20,
                        "description": "The tags the thread has from now on, each by its name (a string of up to 60 characters) or its id (an integer), from [List support tags](/docs/reference/support-threads#list-support-tags). The list replaces the one before; an empty list removes them all.",
                        "items": {
                            "oneOf": [
                                {
                                    "type": "string",
                                    "maxLength": 60
                                },
                                {
                                    "type": "integer"
                                }
                            ]
                        },
                        "example": [
                            "Invitations",
                            "Login"
                        ]
                    },
                    "snoozed_until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Puts an open or waiting thread aside until then (a time still to come, before 2038); null wakes it. It also wakes by itself when the customer writes.",
                        "example": "2026-11-20T08:00:00Z"
                    },
                    "customer": {
                        "type": "string",
                        "maxLength": 140,
                        "description": "Ties the sender of a mail to one of your customers, with every thread of theirs: the customer's ID, or `external_ref:` and your own reference. A chat is tied to the company it came from.",
                        "example": "external_ref:org_48213"
                    },
                    "signed": {
                        "type": "boolean",
                        "description": "Whether answers in this thread end with the first name of the person who wrote them."
                    },
                    "unread": {
                        "type": "boolean",
                        "enum": [
                            false
                        ],
                        "description": "Send `false` once you have shown their messages to someone, to mark the thread read. `true` is refused."
                    },
                    "cc": {
                        "type": "array",
                        "maxItems": 10,
                        "items": {
                            "type": "string",
                            "format": "email"
                        },
                        "description": "The addresses that stay on copy of a mail thread. An address of `cc` you leave out is taken off; an address that was not there is not added."
                    }
                }
            },
            "SupportDraft": {
                "type": "object",
                "description": "A draft of an answer by the assistant. Nothing in it is sent until you send it.",
                "required": [
                    "id",
                    "object",
                    "status",
                    "round",
                    "version",
                    "trigger",
                    "stale",
                    "body",
                    "language",
                    "summary",
                    "kind",
                    "no_reply_needed",
                    "confidence",
                    "recommendation",
                    "questions",
                    "answers",
                    "note",
                    "escalation",
                    "sources",
                    "error",
                    "outcome",
                    "created_at",
                    "finished_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "drf_229"
                    },
                    "object": {
                        "type": "string",
                        "const": "support_draft"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "queued",
                            "running",
                            "ready",
                            "failed",
                            "cancelled"
                        ],
                        "description": "`queued` and `running`: the assistant is at it. `ready`: written. `failed`: it could not be written; see `error`. `cancelled`: given up."
                    },
                    "round": {
                        "type": "integer",
                        "description": "Which turn of the customer it answers: 1 for their first message.",
                        "example": 2
                    },
                    "version": {
                        "type": "integer",
                        "description": "Which version within the round: 2 after one redraft.",
                        "example": 2
                    },
                    "trigger": {
                        "type": "string",
                        "enum": [
                            "new",
                            "followup",
                            "redraft",
                            "manual",
                            "release"
                        ],
                        "description": "What started it: their first message, a later one, a request for another version, a request for a draft, or the follow-up of a released escalation."
                    },
                    "stale": {
                        "type": "boolean",
                        "description": "They have written again since it was drafted."
                    },
                    "body": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The answer the assistant proposes. Null while it is being written, and where it proposes no answer."
                    },
                    "language": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The language of the answer.",
                        "example": "fr"
                    },
                    "summary": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "What the thread is about, in a line."
                    },
                    "kind": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "What the assistant read the thread as: `question`, `bug`, `feature_request` or `other`.",
                        "example": "bug"
                    },
                    "no_reply_needed": {
                        "type": "boolean",
                        "description": "The assistant read their last message as one that needs no answer. You can [agree](/docs/reference/support-assistant#close-support-thread-on-draft) and close the thread."
                    },
                    "confidence": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "high",
                            "medium",
                            "low",
                            null
                        ],
                        "description": "How sure the assistant is of the draft. Null while it is being written."
                    },
                    "recommendation": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "What the assistant advises you to do. Null while the draft is being written.",
                        "required": [
                            "action",
                            "label",
                            "text",
                            "unverified"
                        ],
                        "properties": {
                            "action": {
                                "type": "string",
                                "enum": [
                                    "send",
                                    "ask_customer",
                                    "create_ticket",
                                    "close",
                                    "escalate"
                                ],
                                "description": "`send`: send the draft. `ask_customer`: ask the customer for more. `create_ticket`: escalate to Monotree. `close`: close without answering. `escalate`: hand to Monotree now."
                            },
                            "label": {
                                "type": "string",
                                "description": "The action in words.",
                                "example": "Escalate to Monotree"
                            },
                            "text": {
                                "type": "string",
                                "description": "Why."
                            },
                            "unverified": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "description": "What it could not check."
                            }
                        }
                    },
                    "questions": {
                        "type": "array",
                        "description": "What the assistant would like to know from you for a better version. Answer by [asking for another version](/docs/reference/support-assistant#request-support-draft) with `answers`.",
                        "items": {
                            "type": "object",
                            "required": [
                                "q",
                                "options"
                            ],
                            "properties": {
                                "q": {
                                    "type": "string",
                                    "description": "The question."
                                },
                                "options": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    },
                                    "description": "The answers to pick from."
                                }
                            }
                        }
                    },
                    "answers": {
                        "type": "array",
                        "description": "The options picked for this version.",
                        "items": {
                            "$ref": "#/components/schemas/SupportDraftAnswer"
                        }
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "What was asked of this version."
                    },
                    "escalation": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "An escalation to Monotree the assistant has written out, for you to send with [Escalate a thread](/docs/reference/support-escalations#escalate-support-thread). Null where it proposes none.",
                        "required": [
                            "category",
                            "title",
                            "description",
                            "tags"
                        ],
                        "properties": {
                            "category": {
                                "type": "string",
                                "description": "`bug`, `feature_request` or `investigation`.",
                                "example": "bug"
                            },
                            "title": {
                                "type": "string"
                            },
                            "description": {
                                "type": "string"
                            },
                            "tags": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "description": "Names of tags."
                            }
                        }
                    },
                    "sources": {
                        "type": "array",
                        "description": "What the assistant read to write it. The shape of an entry is not settled yet; show it, do not build on it.",
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "error": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Why it failed. Null unless `status` is `failed`."
                    },
                    "outcome": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "sent_unchanged",
                            "edited",
                            "replaced",
                            "discarded",
                            "superseded",
                            "no_reply_accepted",
                            null
                        ],
                        "description": "What became of it. Null while it waits for you. `sent_unchanged`, `edited`, `replaced`: it was sent, as written, changed, or mostly rewritten. `discarded`: put aside. `superseded`: an answer went out another way, or a draft for their next turn replaced it. `no_reply_accepted`: the thread was closed on it."
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "finished_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the assistant was done with it."
                    }
                },
                "example": {
                    "id": "drf_229",
                    "object": "support_draft",
                    "status": "ready",
                    "round": 2,
                    "version": 2,
                    "trigger": "redraft",
                    "stale": false,
                    "body": "Bonjour Sophie, essayez de vous d\u00e9connecter et de vous reconnecter. Dites-nous si cela ne suffit pas.",
                    "language": "fr",
                    "summary": null,
                    "kind": "bug",
                    "no_reply_needed": false,
                    "confidence": "medium",
                    "recommendation": {
                        "action": "create_ticket",
                        "label": "Escalate to Monotree",
                        "text": "This sounds like a fault in the app rather than a question. Send the first steps, and escalate it to Monotree if they do not help.",
                        "unverified": [
                            "Whether it happens on every phone or only one kind."
                        ]
                    },
                    "questions": [],
                    "answers": [
                        {
                            "q": "Should the answer ask which phone they use now, or only if the first step does not help?",
                            "a": "Ask now"
                        }
                    ],
                    "note": "Shorter, please.",
                    "escalation": {
                        "category": "bug",
                        "title": "Cela ne marche toujours pas, erreur sur Android.",
                        "description": "Reported in support:\n\n> Cela ne marche toujours pas, erreur sur Android.",
                        "tags": []
                    },
                    "sources": [],
                    "error": null,
                    "outcome": null,
                    "created_at": "2026-11-14T12:43:47Z",
                    "finished_at": "2026-11-14T12:43:47Z"
                }
            },
            "SupportDraftAnswer": {
                "type": "object",
                "description": "An option picked for one of a draft's questions.",
                "required": [
                    "q",
                    "a"
                ],
                "properties": {
                    "q": {
                        "type": "string",
                        "maxLength": 500,
                        "description": "The question, word for word."
                    },
                    "a": {
                        "type": "string",
                        "maxLength": 500,
                        "description": "One of its `options`, word for word."
                    }
                }
            },
            "SupportDraftList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SupportDraft"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportDraftRequest": {
                "type": "object",
                "properties": {
                    "from": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "The draft to make another version of. Leave out to ask for a draft of the thread as it stands.",
                        "example": "drf_228"
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 2000,
                        "description": "With `from`: what to change.",
                        "example": "Shorter, please."
                    },
                    "answers": {
                        "type": "array",
                        "maxItems": 10,
                        "description": "With `from`: options picked among the `questions` of that draft. An entry that is not one of its questions and options, word for word, is left out.",
                        "items": {
                            "$ref": "#/components/schemas/SupportDraftAnswer"
                        }
                    }
                }
            },
            "SupportDraftSend": {
                "type": "object",
                "properties": {
                    "body": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 10000,
                        "description": "The answer as you changed it. Leave out to send the draft as it is."
                    },
                    "last_seen_message": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "The latest message of theirs (`direction: in`) you have read. Where that is not their latest message any more, nothing is sent (409 `invalid_state`).",
                        "example": "msg_01m7d1b8f34d98pr5q1mnbdcpt"
                    }
                }
            },
            "SupportEscalation": {
                "type": "object",
                "description": "Something handed on to Monotree from one or more threads of one customer.",
                "required": [
                    "id",
                    "object",
                    "category",
                    "title",
                    "description",
                    "tags",
                    "status",
                    "released_in",
                    "customer",
                    "threads",
                    "created_at",
                    "fixed_at",
                    "released_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "esc_01m7d1cbwj6agthjesfk7198t7"
                    },
                    "object": {
                        "type": "string",
                        "const": "support_escalation"
                    },
                    "category": {
                        "type": "string",
                        "enum": [
                            "bug",
                            "feature_request",
                            "investigation"
                        ],
                        "description": "A fault, a wish, or a look into a customer's data."
                    },
                    "title": {
                        "type": "string",
                        "example": "Invitation link opens a blank page"
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "tags": {
                        "type": "array",
                        "description": "Names of the tags it was sent with.",
                        "items": {
                            "type": "string"
                        },
                        "example": [
                            "Invitations"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "sent",
                            "received",
                            "fixed",
                            "released",
                            "declined"
                        ],
                        "description": "`sent`: waiting for Monotree to pick it up. `received`: Monotree has it. `fixed`: fixed, not yet shipped. `released`: it has shipped; follow up on its threads. `declined`: Monotree will not do it. Every change of status sends `support.escalation.updated`."
                    },
                    "released_in": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The release it shipped in, as Monotree names it.",
                        "example": "App 4.17"
                    },
                    "customer": {
                        "$ref": "#/components/schemas/SupportCustomerRef"
                    },
                    "threads": {
                        "type": "array",
                        "description": "The threads it came from: the one it was made from, and those added to it.",
                        "items": {
                            "type": "object",
                            "required": [
                                "id",
                                "relation",
                                "follow_up_due",
                                "followed_up_at",
                                "follow_up_outcome"
                            ],
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "example": "sth_01m7d1ajq9w7ak2vnnp8hfdwj8"
                                },
                                "relation": {
                                    "type": "string",
                                    "enum": [
                                        "created",
                                        "duplicate"
                                    ],
                                    "description": "`created`: the escalation was made from this thread. `duplicate`: the thread was added to it."
                                },
                                "follow_up_due": {
                                    "type": "boolean",
                                    "description": "It was released and nobody has followed up on this thread."
                                },
                                "followed_up_at": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "date-time"
                                },
                                "follow_up_outcome": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "enum": [
                                        "told",
                                        "no_need",
                                        null
                                    ]
                                }
                            }
                        }
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fixed_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "released_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "example": {
                    "id": "esc_01m7d1cbwj6agthjesfk7198t7",
                    "object": "support_escalation",
                    "category": "bug",
                    "title": "Invitation link opens a blank page",
                    "description": "On Android 14 the link in the invitation mail opens a blank page.",
                    "tags": [
                        "Invitations"
                    ],
                    "status": "sent",
                    "released_in": null,
                    "customer": {
                        "id": "cus_01jcz8w3k1x9q2v7s4e6m0b5n8",
                        "company_name": "Boulangerie Martin",
                        "external_ref": "org_48213"
                    },
                    "threads": [
                        {
                            "id": "sth_01m7d1ajq9w7ak2vnnp8hfdwj8",
                            "relation": "created",
                            "follow_up_due": false,
                            "followed_up_at": null,
                            "follow_up_outcome": null
                        }
                    ],
                    "created_at": "2026-11-14T12:44:09Z",
                    "fixed_at": null,
                    "released_at": null
                }
            },
            "SupportEscalationList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SupportEscalation"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportEscalationCreate": {
                "type": "object",
                "description": "Either `title` and `category` for a new escalation, or `duplicate_of` alone.",
                "properties": {
                    "title": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 120,
                        "description": "Needed unless `duplicate_of` is sent.",
                        "example": "Invitation link opens a blank page"
                    },
                    "category": {
                        "type": "string",
                        "enum": [
                            "bug",
                            "feature_request",
                            "investigation"
                        ],
                        "description": "Needed unless `duplicate_of` is sent."
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 10000,
                        "description": "What happens, where, and how to see it.",
                        "example": "On Android 14 the link in the invitation mail opens a blank page."
                    },
                    "tags": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                            "type": "integer"
                        },
                        "description": "Ids of tags, from [List support tags](/docs/reference/support-threads#list-support-tags). Here only ids are read, not names; an id that is no tag is left out.",
                        "example": [
                            1
                        ]
                    },
                    "duplicate_of": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "An escalation already sent: the thread is added to it and nothing new goes to Monotree. The other fields are then not read.",
                        "example": "esc_01m7d1cbwj6agthjesfk7198t7"
                    }
                }
            },
            "SupportFollowUp": {
                "type": "object",
                "required": [
                    "told"
                ],
                "properties": {
                    "told": {
                        "type": "boolean",
                        "description": "`true`: the customer was (or is being) told. `false`: nobody needs telling."
                    },
                    "draft": {
                        "type": "boolean",
                        "default": false,
                        "description": "Also ask the assistant to draft the message that tells the customer."
                    }
                }
            },
            "SupportWeekHours": {
                "type": "object",
                "description": "The office hours per day, on the 24 hour clock in the desk's `timezone`: `[opens, closes]`, or null for a closed day.",
                "required": [
                    "mon",
                    "tue",
                    "wed",
                    "thu",
                    "fri",
                    "sat",
                    "sun"
                ],
                "properties": {
                    "mon": {
                        "$ref": "#/components/schemas/SupportHours"
                    },
                    "tue": {
                        "$ref": "#/components/schemas/SupportHours"
                    },
                    "wed": {
                        "$ref": "#/components/schemas/SupportHours"
                    },
                    "thu": {
                        "$ref": "#/components/schemas/SupportHours"
                    },
                    "fri": {
                        "$ref": "#/components/schemas/SupportHours"
                    },
                    "sat": {
                        "$ref": "#/components/schemas/SupportHours"
                    },
                    "sun": {
                        "$ref": "#/components/schemas/SupportHours"
                    }
                },
                "example": {
                    "mon": [
                        "09:00",
                        "18:00"
                    ],
                    "tue": [
                        "09:00",
                        "18:00"
                    ],
                    "wed": [
                        "09:00",
                        "18:00"
                    ],
                    "thu": [
                        "09:00",
                        "18:00"
                    ],
                    "fri": [
                        "09:00",
                        "18:00"
                    ],
                    "sat": null,
                    "sun": null
                }
            },
            "SupportHours": {
                "type": [
                    "array",
                    "null"
                ],
                "description": "When a day opens and closes, as two `HH:MM` times with the first before the second. Null for a closed day.",
                "items": {
                    "type": "string",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                },
                "minItems": 2,
                "maxItems": 2,
                "example": [
                    "09:00",
                    "18:00"
                ]
            },
            "SupportSettings": {
                "type": "object",
                "description": "The settings of your support desk.",
                "required": [
                    "object",
                    "auto_draft",
                    "auto",
                    "auto_reply",
                    "timezone",
                    "hours",
                    "holidays",
                    "holidays_extra",
                    "auto_reply_text",
                    "staff_language",
                    "debug",
                    "reopen_days",
                    "idle_close_days",
                    "signature",
                    "ask_rating"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "support_settings"
                    },
                    "auto_draft": {
                        "type": "boolean",
                        "description": "Whether the assistant drafts when a customer writes. Off: only when you ask for a draft."
                    },
                    "auto": {
                        "type": "string",
                        "enum": [
                            "off",
                            "drafts",
                            "sends"
                        ],
                        "description": "How much the assistant does by itself. `off`: it drafts for a thread's messages until your desk has answered once. `drafts`: for every message of theirs. `sends`: it also sends the drafts it is highly sure of; the rest wait for a person, with `needs_person` set on the thread, and no automatic reply is sent."
                    },
                    "auto_reply": {
                        "type": "boolean",
                        "description": "Answer a thread that starts while the desk is offline, once, with `auto_reply_text`."
                    },
                    "timezone": {
                        "type": "string",
                        "description": "An IANA time zone name. The office hours are in it.",
                        "example": "Europe/Paris"
                    },
                    "hours": {
                        "$ref": "#/components/schemas/SupportWeekHours"
                    },
                    "holidays": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "FR",
                            "ES",
                            "IT",
                            "BE",
                            "DK",
                            null
                        ],
                        "description": "The country whose public holidays the desk is closed on. Null for none."
                    },
                    "holidays_extra": {
                        "type": "array",
                        "maxItems": 60,
                        "items": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "More days the desk is closed. Returned in order, each once.",
                        "example": [
                            "2026-12-24"
                        ]
                    },
                    "auto_reply_text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 600,
                        "description": "`{next_open}` becomes when the desk opens next, such as \"tomorrow at 09:00\".",
                        "example": "Thanks for your message. We are closed right now and will answer {next_open}."
                    },
                    "staff_language": {
                        "type": "string",
                        "enum": [
                            "en",
                            "fr",
                            "es",
                            "it",
                            "de",
                            "nl",
                            "da"
                        ],
                        "description": "The language your people read the assistant's advice and translations in."
                    },
                    "debug": {
                        "type": "boolean",
                        "description": "Show how the assistant worked on a draft in the portal."
                    },
                    "reopen_days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 90,
                        "description": "A closed thread opens again when the customer writes within this many days; after that a new thread starts. 0: always a new thread."
                    },
                    "idle_close_days": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 90,
                        "description": "After how many days without a message a thread that waits for the customer is closed by itself, with `resolution` `no_response`. Checked once a day; a snoozed thread is left alone until it wakes. If they write again within `reopen_days`, the thread opens again."
                    },
                    "signature": {
                        "type": "boolean",
                        "description": "End chat answers with the first name of the person who wrote them. Mail always is. A thread can say otherwise (`signed`)."
                    },
                    "ask_rating": {
                        "type": "boolean",
                        "description": "Ask the customer whether the answer helped when a chat is closed."
                    }
                },
                "example": {
                    "object": "support_settings",
                    "auto_draft": true,
                    "auto": "off",
                    "auto_reply": true,
                    "timezone": "Europe/Paris",
                    "hours": {
                        "mon": [
                            "09:00",
                            "18:00"
                        ],
                        "tue": [
                            "09:00",
                            "18:00"
                        ],
                        "wed": [
                            "09:00",
                            "18:00"
                        ],
                        "thu": [
                            "09:00",
                            "18:00"
                        ],
                        "fri": [
                            "09:00",
                            "18:00"
                        ],
                        "sat": null,
                        "sun": null
                    },
                    "holidays": "FR",
                    "holidays_extra": [],
                    "auto_reply_text": "Thanks for your message. We are closed right now and will answer {next_open}.",
                    "staff_language": "en",
                    "debug": false,
                    "reopen_days": 7,
                    "idle_close_days": 7,
                    "signature": true,
                    "ask_rating": true
                }
            },
            "SupportSettingsUpdate": {
                "type": "object",
                "description": "What to change. Each field means what it means in the settings. A field left out is untouched, and so is a day left out of `hours`.",
                "properties": {
                    "auto_draft": {
                        "type": "boolean"
                    },
                    "auto": {
                        "type": "string",
                        "enum": [
                            "off",
                            "drafts",
                            "sends"
                        ]
                    },
                    "auto_reply": {
                        "type": "boolean"
                    },
                    "timezone": {
                        "type": "string",
                        "description": "An IANA time zone name.",
                        "example": "Europe/Paris"
                    },
                    "hours": {
                        "$ref": "#/components/schemas/SupportWeekHours"
                    },
                    "holidays": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "FR",
                            "ES",
                            "IT",
                            "BE",
                            "DK",
                            null
                        ]
                    },
                    "holidays_extra": {
                        "type": "array",
                        "maxItems": 60,
                        "items": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    "auto_reply_text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 600
                    },
                    "staff_language": {
                        "type": "string",
                        "enum": [
                            "en",
                            "fr",
                            "es",
                            "it",
                            "de",
                            "nl",
                            "da"
                        ]
                    },
                    "debug": {
                        "type": "boolean"
                    },
                    "reopen_days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 90
                    },
                    "idle_close_days": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 90
                    },
                    "signature": {
                        "type": "boolean"
                    },
                    "ask_rating": {
                        "type": "boolean"
                    }
                }
            },
            "SupportPresence": {
                "type": "object",
                "description": "Whether your support desk is there to answer right now.",
                "required": [
                    "object",
                    "online",
                    "forced",
                    "forced_until",
                    "forced_by",
                    "changes_at"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "support_presence"
                    },
                    "online": {
                        "type": "boolean"
                    },
                    "forced": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "online",
                            "offline",
                            null
                        ],
                        "description": "Set where someone switched it against the office hours. Null while the hours decide."
                    },
                    "forced_until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the forced state ends by itself."
                    },
                    "forced_by": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Who switched it: a person, or `API \u00b7 ` and the name of the token.",
                        "example": "API \u00b7 Back office, production"
                    },
                    "changes_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the office hours next open or close."
                    }
                },
                "example": {
                    "object": "support_presence",
                    "online": true,
                    "forced": "online",
                    "forced_until": "2026-11-14T13:45:37Z",
                    "forced_by": "API \u00b7 Back office, production",
                    "changes_at": "2026-11-16T08:00:00Z"
                }
            },
            "SupportPresenceSet": {
                "type": "object",
                "required": [
                    "online"
                ],
                "properties": {
                    "online": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "description": "`true`: online. `false`: offline. `null`: follow the office hours again."
                    }
                }
            },
            "SupportMemory": {
                "type": "object",
                "description": "One fact the assistant was taught, or proposes to remember.",
                "required": [
                    "id",
                    "object",
                    "name",
                    "description",
                    "body",
                    "status",
                    "thread",
                    "created_at",
                    "approved_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "mem_6"
                    },
                    "object": {
                        "type": "string",
                        "const": "support_memory"
                    },
                    "name": {
                        "type": "string",
                        "description": "A short name in lower case with dashes, made from what you send. Where the name is taken, a number is added.",
                        "example": "employees-are-added-by-the-admin"
                    },
                    "description": {
                        "type": "string",
                        "description": "What it is about, in a line.",
                        "example": "Employees are added by the customer's admin"
                    },
                    "body": {
                        "type": "string",
                        "description": "The fact itself.",
                        "example": "Only the admin of a customer can add employees: Users, then Invite. Support never adds them."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "proposed",
                            "remembered"
                        ],
                        "description": "`remembered`: the assistant uses it. `proposed`: it waits for you to agree."
                    },
                    "thread": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The thread whose answer a proposal came from. Null for a fact you wrote.",
                        "example": null
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "approved_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When it was written or last agreed to. Null for a proposal."
                    }
                },
                "example": {
                    "id": "mem_6",
                    "object": "support_memory",
                    "name": "employees-are-added-by-the-admin",
                    "description": "Employees are added by the customer's admin",
                    "body": "Only the admin of a customer can add employees: Users, then Invite. Support never adds them.",
                    "status": "remembered",
                    "thread": null,
                    "created_at": "2026-11-14T12:45:47Z",
                    "approved_at": "2026-11-14T12:45:47Z"
                }
            },
            "SupportMemoryList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SupportMemory"
                                }
                            }
                        }
                    }
                ]
            },
            "SupportMemoryCreate": {
                "type": "object",
                "description": "Either `name`, `description` and `body`, or `from_message` alone.",
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 70,
                        "description": "A short name. It is kept in lower case with dashes.",
                        "example": "Employees are added by the admin"
                    },
                    "description": {
                        "type": "string",
                        "maxLength": 200,
                        "description": "What the fact is about, in a line.",
                        "example": "Employees are added by the customer's admin"
                    },
                    "body": {
                        "type": "string",
                        "maxLength": 4000,
                        "description": "The fact itself.",
                        "example": "Only the admin of a customer can add employees: Users, then Invite. Support never adds them."
                    },
                    "from_message": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "Instead of the three above: an answer of yours for the assistant to learn from.",
                        "example": "msg_01m7d1awpxds8kqrrt6733j0d2"
                    }
                }
            },
            "SupportMemoryUpdate": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 70
                    },
                    "description": {
                        "type": "string",
                        "maxLength": 200
                    },
                    "body": {
                        "type": "string",
                        "maxLength": 4000
                    }
                }
            },
            "SupportShare": {
                "type": "object",
                "description": "One row of a breakdown.",
                "required": [
                    "key",
                    "label",
                    "count",
                    "share_percent"
                ],
                "properties": {
                    "key": {
                        "type": "string",
                        "description": "A code or an ID for the row that stays the same, whatever the row is called.",
                        "example": "chat"
                    },
                    "label": {
                        "type": "string",
                        "description": "The row in English, to show.",
                        "example": "Chat"
                    },
                    "count": {
                        "type": "integer",
                        "example": 2
                    },
                    "share_percent": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Its share of the breakdown's total. Null where the total is 0.",
                        "example": 67
                    }
                }
            },
            "SupportStatsKpi": {
                "type": "object",
                "description": "One headline number.",
                "required": [
                    "key",
                    "label",
                    "unit",
                    "value",
                    "today",
                    "before",
                    "change_percent",
                    "higher_is_better",
                    "series"
                ],
                "properties": {
                    "key": {
                        "type": "string",
                        "enum": [
                            "new",
                            "solved",
                            "response",
                            "solving",
                            "unchanged",
                            "drafted"
                        ],
                        "description": "`new`: threads customers started. `solved`: threads closed. `response`: the median time to the first answer, counted in office hours. `solving`: the median time from start to close. `unchanged`: the share of sent drafts that went out as written. `drafted`: drafts the assistant wrote."
                    },
                    "label": {
                        "type": "string",
                        "example": "Solved"
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "threads",
                            "minutes",
                            "percent",
                            "drafts"
                        ]
                    },
                    "value": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The number over the period. Null where there is nothing to measure."
                    },
                    "today": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The number for the last day of the period. Only for `new`, `solved` and `drafted`."
                    },
                    "before": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The same number over the period of the same length before. Null for all time."
                    },
                    "change_percent": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The change against `before`. Null where `before` is 0 or null."
                    },
                    "higher_is_better": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "description": "Null where neither is better."
                    },
                    "series": {
                        "type": "array",
                        "items": {
                            "type": "integer"
                        },
                        "description": "The number per day, oldest first, at most 90 days. Only for `new`, `solved` and `drafted`; empty for the others."
                    }
                }
            },
            "SupportStatsDay": {
                "type": "object",
                "description": "One day of the period.",
                "required": [
                    "day",
                    "new",
                    "solved",
                    "drafted",
                    "channels"
                ],
                "properties": {
                    "day": {
                        "type": "string",
                        "format": "date"
                    },
                    "new": {
                        "type": "integer"
                    },
                    "solved": {
                        "type": "integer"
                    },
                    "drafted": {
                        "type": "integer"
                    },
                    "channels": {
                        "type": "object",
                        "description": "New threads by channel.",
                        "required": [
                            "chat",
                            "email"
                        ],
                        "properties": {
                            "chat": {
                                "type": "integer"
                            },
                            "email": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "SupportStatsTopic": {
                "type": "object",
                "description": "The threads with one tag. A thread with two tags counts under both.",
                "required": [
                    "tag_id",
                    "label",
                    "count",
                    "before",
                    "change_percent",
                    "unsure_share_percent",
                    "rewritten",
                    "fell_short_share_percent",
                    "handed_to_person_share_percent",
                    "escalated_share_percent",
                    "negative_ratings"
                ],
                "properties": {
                    "tag_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The tag. Null for the row of threads without a tag."
                    },
                    "label": {
                        "type": "string",
                        "description": "The tag's name, or `No topic`.",
                        "example": "Invitations"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "before": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The count over the period before. Null for all time and for the row without a tag."
                    },
                    "change_percent": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "unsure_share_percent": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Threads with a draft of low or medium confidence."
                    },
                    "rewritten": {
                        "type": "integer",
                        "description": "Threads where the draft was sent mostly rewritten."
                    },
                    "fell_short_share_percent": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Threads that are one or the other of the two above."
                    },
                    "handed_to_person_share_percent": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Threads the assistant left to a person."
                    },
                    "escalated_share_percent": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Threads escalated to Monotree."
                    },
                    "negative_ratings": {
                        "type": "integer"
                    }
                }
            },
            "SupportStats": {
                "type": "object",
                "description": "The numbers of your support desk over a period.",
                "required": [
                    "object",
                    "days",
                    "span_days",
                    "from",
                    "to",
                    "kpis",
                    "facts",
                    "daily",
                    "channels",
                    "kinds",
                    "topics",
                    "ratings",
                    "customers",
                    "draft_outcomes",
                    "draft_versions",
                    "escalations",
                    "waiting_ages",
                    "started_by_hour",
                    "staff",
                    "assistant"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "support_stats"
                    },
                    "days": {
                        "type": "integer",
                        "enum": [
                            1,
                            -1,
                            7,
                            30,
                            90,
                            0
                        ],
                        "description": "The period asked for.",
                        "example": 7
                    },
                    "span_days": {
                        "type": "integer",
                        "description": "How many days the period covers. For all time, the days since your first thread."
                    },
                    "from": {
                        "type": "string",
                        "format": "date"
                    },
                    "to": {
                        "type": "string",
                        "format": "date"
                    },
                    "kpis": {
                        "type": "array",
                        "description": "The six headline numbers, always in the order `new`, `solved`, `response`, `solving`, `unchanged`, `drafted`.",
                        "items": {
                            "$ref": "#/components/schemas/SupportStatsKpi"
                        }
                    },
                    "facts": {
                        "type": "object",
                        "required": [
                            "threads_per_day",
                            "escalated_share_percent",
                            "no_reply_needed_share_percent",
                            "reopened_share_percent",
                            "auto_replies",
                            "oldest_waiting_minutes",
                            "urgent"
                        ],
                        "properties": {
                            "threads_per_day": {
                                "type": "number",
                                "description": "New threads per day of the period, to one decimal."
                            },
                            "escalated_share_percent": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "description": "New threads that were escalated to Monotree."
                            },
                            "no_reply_needed_share_percent": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "reopened_share_percent": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "auto_replies": {
                                "type": "integer",
                                "description": "New threads that got the automatic reply."
                            },
                            "oldest_waiting_minutes": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "description": "How long the oldest open thread has waited for you, as of now. Null where none waits."
                            },
                            "urgent": {
                                "type": "integer",
                                "description": "New threads that are urgent."
                            }
                        }
                    },
                    "daily": {
                        "type": "array",
                        "description": "Each day of the period, oldest first, at most the last 90.",
                        "items": {
                            "$ref": "#/components/schemas/SupportStatsDay"
                        }
                    },
                    "channels": {
                        "type": "array",
                        "description": "New threads by channel. `key` is `chat` or `email`.",
                        "items": {
                            "$ref": "#/components/schemas/SupportShare"
                        }
                    },
                    "kinds": {
                        "type": "array",
                        "description": "New threads by kind. `key` is a kind, or `unread` for threads the assistant has not read.",
                        "items": {
                            "$ref": "#/components/schemas/SupportShare"
                        }
                    },
                    "topics": {
                        "type": "array",
                        "description": "What customers ask about, by tag, most first, and where the help fell short.",
                        "items": {
                            "$ref": "#/components/schemas/SupportStatsTopic"
                        }
                    },
                    "ratings": {
                        "type": "object",
                        "required": [
                            "asked",
                            "rated",
                            "answered_share_percent",
                            "positive",
                            "negative",
                            "helpful_share_percent",
                            "negative_threads"
                        ],
                        "properties": {
                            "asked": {
                                "type": "integer",
                                "description": "Threads where the customer was asked whether the answer helped."
                            },
                            "rated": {
                                "type": "integer"
                            },
                            "answered_share_percent": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "description": "`rated` as a share of `asked`."
                            },
                            "positive": {
                                "type": "integer"
                            },
                            "negative": {
                                "type": "integer"
                            },
                            "helpful_share_percent": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "description": "`positive` as a share of `rated`."
                            },
                            "negative_threads": {
                                "type": "array",
                                "description": "The six latest threads rated negative.",
                                "items": {
                                    "type": "object",
                                    "required": [
                                        "thread",
                                        "title",
                                        "customer",
                                        "assignee",
                                        "rated_at"
                                    ],
                                    "properties": {
                                        "thread": {
                                            "type": "string",
                                            "description": "The thread's ID.",
                                            "example": "sth_01m7d1ajq9w7ak2vnnp8hfdwj8"
                                        },
                                        "title": {
                                            "type": "string",
                                            "description": "Its summary, subject or preview."
                                        },
                                        "customer": {
                                            "type": "string",
                                            "description": "The customer's company name.",
                                            "example": "Boulangerie Martin"
                                        },
                                        "assignee": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "The name of the person who has it."
                                        },
                                        "rated_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "format": "date-time"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "customers": {
                        "type": "array",
                        "description": "The eight customers who wrote most. `key` is the customer's ID (`cus_\u2026`), `label` its company name.",
                        "items": {
                            "$ref": "#/components/schemas/SupportShare"
                        }
                    },
                    "draft_outcomes": {
                        "type": "array",
                        "description": "What became of the assistant's drafts. `key` is `sent_unchanged`, `edited`, `replaced`, `no_reply_accepted` or `discarded`; all five rows are always there.",
                        "items": {
                            "$ref": "#/components/schemas/SupportShare"
                        }
                    },
                    "draft_versions": {
                        "type": "object",
                        "required": [
                            "sent",
                            "with_questions",
                            "questions_answered"
                        ],
                        "properties": {
                            "sent": {
                                "type": "array",
                                "description": "Which version of a draft was the one sent. `key` is `1`, `2`, `3`, or `4` for a fourth or later.",
                                "items": {
                                    "$ref": "#/components/schemas/SupportShare"
                                }
                            },
                            "with_questions": {
                                "type": "integer",
                                "description": "Drafts that came with questions for you."
                            },
                            "questions_answered": {
                                "type": "integer",
                                "description": "Drafts made from an answer to such questions."
                            }
                        }
                    },
                    "escalations": {
                        "type": "array",
                        "description": "Threads handed to Monotree. `key` is `created` (a new escalation) or `duplicate` (added to one already sent).",
                        "items": {
                            "$ref": "#/components/schemas/SupportShare"
                        }
                    },
                    "waiting_ages": {
                        "type": "array",
                        "description": "How long the threads that wait for you now have waited, in five rows. `key` is `under_1h`, `1h_to_4h`, `4h_to_24h`, `1d_to_3d` or `over_3d`. Not bound to the period.",
                        "items": {
                            "$ref": "#/components/schemas/SupportShare"
                        }
                    },
                    "started_by_hour": {
                        "type": "object",
                        "required": [
                            "grid",
                            "max"
                        ],
                        "properties": {
                            "grid": {
                                "type": "array",
                                "description": "Seven rows, Monday first, of 24 counts: new threads started in that hour of the day in your desk's time zone.",
                                "items": {
                                    "type": "array",
                                    "items": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "max": {
                                "type": "integer",
                                "description": "The largest count in the grid, at least 1."
                            }
                        }
                    },
                    "staff": {
                        "type": "array",
                        "description": "Answers sent from the portal per person, the eight who sent most. `key` is the seller's ID (`sel_\u2026`), `label` their name. Answers sent over the API are not counted.",
                        "items": {
                            "$ref": "#/components/schemas/SupportShare"
                        }
                    },
                    "assistant": {
                        "type": "object",
                        "required": [
                            "drafts",
                            "failed",
                            "threads",
                            "drafts_per_thread",
                            "median_seconds"
                        ],
                        "properties": {
                            "drafts": {
                                "type": "integer",
                                "description": "Drafts written in the period."
                            },
                            "failed": {
                                "type": "integer"
                            },
                            "threads": {
                                "type": "integer",
                                "description": "Threads they were written for."
                            },
                            "drafts_per_thread": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "median_seconds": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "description": "How long a draft takes the assistant."
                            }
                        }
                    }
                },
                "example": {
                    "object": "support_stats",
                    "days": 7,
                    "span_days": 7,
                    "from": "2026-11-08",
                    "to": "2026-11-14",
                    "kpis": [
                        {
                            "key": "new",
                            "label": "New threads",
                            "unit": "threads",
                            "value": 3,
                            "today": 3,
                            "before": 0,
                            "change_percent": null,
                            "higher_is_better": null,
                            "series": [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                3
                            ]
                        },
                        {
                            "key": "solved",
                            "label": "Solved",
                            "unit": "threads",
                            "value": 0,
                            "today": 0,
                            "before": 0,
                            "change_percent": null,
                            "higher_is_better": true,
                            "series": [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ]
                        },
                        {
                            "key": "response",
                            "label": "First answer, median",
                            "unit": "minutes",
                            "value": 0,
                            "today": null,
                            "before": null,
                            "change_percent": null,
                            "higher_is_better": false,
                            "series": []
                        },
                        {
                            "key": "solving",
                            "label": "Solved in, median",
                            "unit": "minutes",
                            "value": null,
                            "today": null,
                            "before": null,
                            "change_percent": null,
                            "higher_is_better": false,
                            "series": []
                        },
                        {
                            "key": "unchanged",
                            "label": "Drafts sent unchanged",
                            "unit": "percent",
                            "value": 0,
                            "today": null,
                            "before": null,
                            "change_percent": null,
                            "higher_is_better": true,
                            "series": []
                        },
                        {
                            "key": "drafted",
                            "label": "Drafts by the assistant",
                            "unit": "drafts",
                            "value": 8,
                            "today": 8,
                            "before": 0,
                            "change_percent": null,
                            "higher_is_better": null,
                            "series": [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                8
                            ]
                        }
                    ],
                    "facts": {
                        "threads_per_day": 0.4,
                        "escalated_share_percent": 100,
                        "no_reply_needed_share_percent": 33,
                        "reopened_share_percent": 33,
                        "auto_replies": 3,
                        "oldest_waiting_minutes": null,
                        "urgent": 0
                    },
                    "daily": [
                        {
                            "day": "2026-11-13",
                            "new": 0,
                            "solved": 0,
                            "drafted": 0,
                            "channels": {
                                "chat": 0,
                                "email": 0
                            }
                        },
                        {
                            "day": "2026-11-14",
                            "new": 3,
                            "solved": 0,
                            "drafted": 8,
                            "channels": {
                                "chat": 2,
                                "email": 1
                            }
                        }
                    ],
                    "channels": [
                        {
                            "key": "chat",
                            "label": "Chat",
                            "count": 2,
                            "share_percent": 67
                        },
                        {
                            "key": "email",
                            "label": "E-mail",
                            "count": 1,
                            "share_percent": 33
                        }
                    ],
                    "kinds": [
                        {
                            "key": "bug",
                            "label": "Bug",
                            "count": 1,
                            "share_percent": 33
                        },
                        {
                            "key": "other",
                            "label": "Other",
                            "count": 1,
                            "share_percent": 33
                        },
                        {
                            "key": "question",
                            "label": "Question",
                            "count": 1,
                            "share_percent": 33
                        }
                    ],
                    "topics": [
                        {
                            "tag_id": null,
                            "label": "No topic",
                            "count": 2,
                            "before": null,
                            "change_percent": null,
                            "unsure_share_percent": 0,
                            "rewritten": 0,
                            "fell_short_share_percent": 0,
                            "handed_to_person_share_percent": 0,
                            "escalated_share_percent": 100,
                            "negative_ratings": 0
                        },
                        {
                            "tag_id": 1,
                            "label": "Invitations",
                            "count": 1,
                            "before": 0,
                            "change_percent": null,
                            "unsure_share_percent": 100,
                            "rewritten": 0,
                            "fell_short_share_percent": 100,
                            "handed_to_person_share_percent": 0,
                            "escalated_share_percent": 100,
                            "negative_ratings": 0
                        }
                    ],
                    "ratings": {
                        "asked": 0,
                        "rated": 0,
                        "answered_share_percent": null,
                        "positive": 0,
                        "negative": 0,
                        "helpful_share_percent": null,
                        "negative_threads": []
                    },
                    "customers": [
                        {
                            "key": "Boulangerie Martin",
                            "label": "Boulangerie Martin",
                            "count": 2,
                            "share_percent": 67
                        },
                        {
                            "key": "Le Petit Bistrot",
                            "label": "Le Petit Bistrot",
                            "count": 1,
                            "share_percent": 33
                        }
                    ],
                    "draft_outcomes": [
                        {
                            "key": "sent_unchanged",
                            "label": "Sent as it was",
                            "count": 0,
                            "share_percent": 0
                        },
                        {
                            "key": "edited",
                            "label": "Sent after an edit",
                            "count": 1,
                            "share_percent": 33
                        },
                        {
                            "key": "replaced",
                            "label": "Replaced by own answer",
                            "count": 0,
                            "share_percent": 0
                        },
                        {
                            "key": "no_reply_accepted",
                            "label": "Nothing to answer",
                            "count": 1,
                            "share_percent": 33
                        },
                        {
                            "key": "discarded",
                            "label": "Not used",
                            "count": 1,
                            "share_percent": 33
                        }
                    ],
                    "draft_versions": {
                        "sent": [
                            {
                                "key": "1",
                                "label": "The first draft",
                                "count": 0,
                                "share_percent": 0
                            },
                            {
                                "key": "2",
                                "label": "The second",
                                "count": 1,
                                "share_percent": 100
                            },
                            {
                                "key": "3",
                                "label": "The third",
                                "count": 0,
                                "share_percent": 0
                            },
                            {
                                "key": "4",
                                "label": "A fourth or later",
                                "count": 0,
                                "share_percent": 0
                            }
                        ],
                        "with_questions": 4,
                        "questions_answered": 1
                    },
                    "escalations": [
                        {
                            "key": "created",
                            "label": "New escalation",
                            "count": 1,
                            "share_percent": 33
                        },
                        {
                            "key": "duplicate",
                            "label": "Added to one sent",
                            "count": 2,
                            "share_percent": 67
                        }
                    ],
                    "waiting_ages": [
                        {
                            "key": "Under an hour",
                            "label": "Under an hour",
                            "count": 0,
                            "share_percent": null
                        },
                        {
                            "key": "1 to 4 hours",
                            "label": "1 to 4 hours",
                            "count": 0,
                            "share_percent": null
                        },
                        {
                            "key": "4 to 24 hours",
                            "label": "4 to 24 hours",
                            "count": 0,
                            "share_percent": null
                        },
                        {
                            "key": "1 to 3 days",
                            "label": "1 to 3 days",
                            "count": 0,
                            "share_percent": null
                        },
                        {
                            "key": "Over 3 days",
                            "label": "Over 3 days",
                            "count": 0,
                            "share_percent": null
                        }
                    ],
                    "started_by_hour": {
                        "grid": [
                            [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                3,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ],
                            [
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0
                            ]
                        ],
                        "max": 3
                    },
                    "staff": [],
                    "assistant": {
                        "drafts": 8,
                        "failed": 0,
                        "threads": 3,
                        "drafts_per_thread": 2.7,
                        "median_seconds": 17
                    }
                }
            },
            "WebhookEndpoint": {
                "type": "object",
                "required": [
                    "id",
                    "object",
                    "url",
                    "events",
                    "active",
                    "sandbox"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "whe_01jd1f4c8m2p0r6t9w3y5a7c1e"
                    },
                    "object": {
                        "type": "string",
                        "const": "webhook_endpoint"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "example": "https://api.acme.example/hooks/monotree"
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Your own note about the endpoint.",
                        "example": "Back office, production"
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "The event types it gets; `*` for all.",
                        "example": [
                            "customer.live",
                            "customer.failed"
                        ]
                    },
                    "active": {
                        "type": "boolean",
                        "description": "False while the endpoint is paused: no events are sent to it.",
                        "example": true
                    },
                    "paused_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Since when it is paused; null while it is on."
                    },
                    "paused_reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "manual",
                            "failing",
                            null
                        ],
                        "description": "`manual`: paused by you. `failing`: paused by Monotree after 5 days of nothing but failed deliveries, at least 20 of them."
                    },
                    "secret": {
                        "type": "string",
                        "description": "The signing secret (`whsec_\u2026`). Only in the answers to Add a webhook endpoint and Rotate the signing secret."
                    },
                    "previous_secret_expires_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "After a rotation, until when events are also signed with the secret before it. Null otherwise."
                    },
                    "failed_24h": {
                        "type": "integer",
                        "description": "Deliveries that gave up as `failed` in the last 24 hours.",
                        "example": 0
                    },
                    "last_delivery": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "The newest delivery to the endpoint.",
                        "properties": {
                            "id": {
                                "type": "string",
                                "example": "whd_01jd1g2h3j4k5m6n7p8q9r0s1t"
                            },
                            "status": {
                                "type": "string",
                                "enum": [
                                    "pending",
                                    "delivered",
                                    "retrying",
                                    "failed"
                                ]
                            },
                            "response_code": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "example": 200
                            },
                            "created_at": {
                                "type": "string",
                                "format": "date-time"
                            }
                        },
                        "example": {
                            "id": "whd_01jd1g2h3j4k5m6n7p8q9r0s1t",
                            "status": "delivered",
                            "response_code": 200,
                            "created_at": "2026-11-12T09:42:18Z"
                        }
                    },
                    "sandbox": {
                        "type": "boolean",
                        "example": false
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2026-11-10T14:05:00Z"
                    }
                }
            },
            "WebhookEndpointCreate": {
                "type": "object",
                "required": [
                    "url"
                ],
                "properties": {
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "maxLength": 255,
                        "description": "An `https` URL that leads to a public address. `http` and local hosts are refused."
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 120,
                        "description": "Your own note about the endpoint."
                    },
                    "events": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                            "type": "string",
                            "example": "customer.live"
                        },
                        "default": [
                            "*"
                        ],
                        "description": "`*` for every event, also ones added later, or the types you want from the Event types guide (`customer.live`, `customer.failed`, \u2026). An unknown type is refused."
                    },
                    "active": {
                        "type": "boolean",
                        "default": true,
                        "description": "`false` adds the endpoint paused."
                    }
                }
            },
            "WebhookEndpointUpdate": {
                "type": "object",
                "properties": {
                    "url": {
                        "$ref": "#/components/schemas/WebhookEndpointCreate/properties/url"
                    },
                    "description": {
                        "$ref": "#/components/schemas/WebhookEndpointCreate/properties/description"
                    },
                    "events": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                            "type": "string",
                            "example": "customer.live"
                        },
                        "description": "The whole list, replacing the one before."
                    },
                    "active": {
                        "type": "boolean",
                        "description": "`false` pauses the endpoint, `true` switches it on again."
                    }
                }
            },
            "WebhookEndpointList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/WebhookEndpoint"
                                }
                            }
                        }
                    }
                ]
            },
            "WebhookDelivery": {
                "type": "object",
                "required": [
                    "id",
                    "object",
                    "event_id",
                    "event",
                    "status",
                    "attempts"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "whd_01jd1g2h3j4k5m6n7p8q9r0s1t"
                    },
                    "object": {
                        "type": "string",
                        "const": "webhook_delivery"
                    },
                    "event_id": {
                        "type": "string",
                        "description": "The `id` of the event that was sent.",
                        "example": "evt_01jcz8wg4h7v3y6n9q2k5m8p1r"
                    },
                    "event": {
                        "type": "string",
                        "description": "The event type.",
                        "example": "customer.live"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "pending",
                            "delivered",
                            "retrying",
                            "failed"
                        ],
                        "description": "`pending` waiting for its first try \u00b7 `delivered` your server answered 2xx \u00b7 `retrying` a try failed and another is planned at `next_attempt_at` \u00b7 `failed` given up after six tries.",
                        "example": "delivered"
                    },
                    "attempts": {
                        "type": "integer",
                        "description": "Tries made so far, of six at most (a test event is tried once). Sending the delivery again starts them over at 1; `redeliveries` says how often that happened.",
                        "example": 1
                    },
                    "redeliveries": {
                        "type": "integer",
                        "description": "How many times the delivery was sent again by hand: with Redeliver a delivery, Redeliver failed deliveries or the button in the portal. 0 for a delivery that was never sent again.",
                        "example": 0
                    },
                    "response_code": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "The status code of your server's last answer. Null when there was none (a timeout, no connection).",
                        "example": 200
                    },
                    "duration_ms": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "example": 182
                    },
                    "next_attempt_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "example": null
                    },
                    "delivered_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "example": "2026-11-12T09:42:18Z"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2026-11-12T09:42:18Z"
                    },
                    "payload": {
                        "$ref": "#/components/schemas/Event",
                        "description": "The event body sent, the same on every try. Only when one delivery is asked for, and only when the token may read events of this type."
                    },
                    "response_body": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The first 2,000 bytes of your server's last answer, or the error when there was none. Only when one delivery is asked for, and only when the token may read events of this type."
                    }
                }
            },
            "WebhookDeliveryList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/WebhookDelivery"
                                }
                            }
                        }
                    }
                ]
            },
            "Token": {
                "type": "object",
                "required": [
                    "id",
                    "object",
                    "name",
                    "abilities",
                    "sandbox"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "example": "tok_7"
                    },
                    "object": {
                        "type": "string",
                        "const": "token"
                    },
                    "name": {
                        "type": "string",
                        "example": "Back office, production"
                    },
                    "abilities": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Ability"
                        },
                        "example": [
                            "customers:read",
                            "customers:write",
                            "webhooks:manage"
                        ]
                    },
                    "sandbox": {
                        "type": "boolean",
                        "example": false
                    },
                    "hint": {
                        "type": "string",
                        "description": "The start and the last four characters of the token, to tell tokens apart.",
                        "example": "mpt_live_\u2026yQoP"
                    },
                    "token": {
                        "type": "string",
                        "description": "The token itself (`mpt_live_\u2026` or `mpt_test_\u2026`). Only in the answer to Create an API token."
                    },
                    "last_used_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "example": "2026-11-14T08:12:44Z"
                    },
                    "expires_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the token stops working; null for never.",
                        "example": null
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2026-11-10T14:00:00Z"
                    }
                }
            },
            "Ability": {
                "type": "string",
                "description": "What a token may do. See the Authentication guide.",
                "enum": [
                    "customers:read",
                    "customers:write",
                    "sellers:write",
                    "admins:write",
                    "security:read",
                    "webhooks:manage",
                    "tokens:manage",
                    "support:read",
                    "support:write",
                    "support:configure"
                ]
            },
            "TokenCreate": {
                "type": "object",
                "required": [
                    "name",
                    "abilities"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "A name for your own use. It shows on timelines as `API \u00b7 <name>`.",
                        "example": "Back office, rotated 2026-11"
                    },
                    "abilities": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                            "$ref": "#/components/schemas/Ability"
                        },
                        "description": "What the token may do: only abilities the calling token has itself."
                    },
                    "sandbox": {
                        "type": "boolean",
                        "description": "Defaults to the mode of the calling token. A sandbox token cannot ask for `false`."
                    },
                    "expires_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "When the token stops working; a time in the future and before 2038. Left out or null: never.",
                        "example": "2027-11-14T00:00:00Z"
                    }
                }
            },
            "TokenList": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ListMeta"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Token"
                                }
                            }
                        }
                    }
                ]
            },
            "Partner": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "name",
                    "token",
                    "api_version"
                ],
                "properties": {
                    "object": {
                        "type": "string",
                        "const": "partner"
                    },
                    "id": {
                        "type": "string",
                        "description": "Your company's ID.",
                        "example": "prt_acme"
                    },
                    "name": {
                        "type": "string",
                        "example": "Acme Scheduling"
                    },
                    "token": {
                        "type": "object",
                        "description": "The token this call was made with.",
                        "required": [
                            "id",
                            "name",
                            "abilities",
                            "sandbox"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "example": "tok_7"
                            },
                            "name": {
                                "type": "string",
                                "example": "Back office, production"
                            },
                            "abilities": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Ability"
                                },
                                "example": [
                                    "customers:read",
                                    "customers:write",
                                    "webhooks:manage"
                                ]
                            },
                            "sandbox": {
                                "type": "boolean",
                                "description": "True for a sandbox token (`mpt_test_\u2026`).",
                                "example": false
                            }
                        }
                    },
                    "api_version": {
                        "type": "string",
                        "description": "The version of the API. See the guide Versions and changelog.",
                        "example": "1.0.0"
                    }
                }
            }
        }
    }
}