{
  "openapi": "3.1.0",
  "info": {
    "title": "Tooli API",
    "version": "1",
    "description": "Version 1 of the API reads your organisation's records and, with a key that may, changes some of them. This page is made from the list of routes the server itself decides with, and a test holds every route, filter and field on it to the running API, so a change to the API fails the test until this page changes too.\n\nEach key may make 120 requests every 60 seconds; past it the answer is 429 with Retry-After."
  },
  "servers": [
    {
      "url": "https://app.tooli.dev"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Every request carries a key in the Authorization header. Owners and admins make keys in Organisation → API and MCP, each with what it may do area by area (read, or read and change); a key is shown once. A sign-in to the app never works on /api/v1, and a key works nowhere else."
      }
    },
    "schemas": {
      "Organization": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Its name."
          },
          "plan": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The plan's name."
              }
            },
            "required": [
              "name"
            ],
            "description": "Its plan."
          },
          "month": {
            "type": "string",
            "description": "The month the counts are for, as YYYY-MM."
          },
          "usage": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "emails_month",
                    "members",
                    "websites",
                    "domains",
                    "documents"
                  ],
                  "description": "The limit."
                },
                "used": {
                  "type": "number",
                  "description": "How much is used."
                },
                "limit": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "The limit; null for none."
                }
              },
              "required": [
                "key",
                "used",
                "limit"
              ]
            },
            "description": "What it has used of each of its plan's limits this month."
          }
        },
        "required": [
          "name",
          "plan",
          "month",
          "usage"
        ],
        "title": "Organisation",
        "description": "Your organisation as a key reads it."
      },
      "Email": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What it is known by: the same id its page's address and a webhook carry."
          },
          "subject": {
            "type": "string",
            "description": "Its subject."
          },
          "sentAt": {
            "type": "string",
            "description": "When it was sent."
          },
          "sender": {
            "type": "string",
            "description": "Who sent it."
          },
          "provider": {
            "type": "string",
            "description": "The mail service it was sent through."
          },
          "mailbox": {
            "type": [
              "string",
              "null"
            ],
            "description": "The address it was sent from, where known."
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Each address it went to, in order."
          },
          "shared": {
            "type": "boolean",
            "description": "Shared with the organisation."
          },
          "views": {
            "type": "number",
            "description": "Every view, a machine's too."
          },
          "humanViews": {
            "type": "number",
            "description": "Views a person most likely made."
          },
          "clicks": {
            "type": "number",
            "description": "Clicks on links in it."
          },
          "replies": {
            "type": "number",
            "description": "Replies noticed in the sender's mailbox."
          },
          "firstViewedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its first view."
          },
          "lastViewedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its latest view."
          },
          "lastClickedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its latest click."
          },
          "repliedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its latest reply."
          },
          "lastPlace": {
            "type": "object",
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The country, as a two-letter code."
              },
              "region": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The region."
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The city."
              }
            },
            "required": [
              "country",
              "region",
              "city"
            ],
            "description": "Where its latest view came from; nulls where a mail service's proxy hid it."
          },
          "viewsByDay": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "Views on each of the last seven days, oldest first."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The tag's id."
                },
                "name": {
                  "type": "string",
                  "description": "Its name."
                }
              },
              "required": [
                "id",
                "name"
              ]
            },
            "description": "Its tags, among those the caller may see."
          },
          "folder": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "The folder's id."
              },
              "name": {
                "type": "string",
                "description": "Its name."
              }
            },
            "required": [
              "id",
              "name"
            ],
            "description": "Its folder, among those the caller may see."
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it was archived; null while it isn't."
          },
          "page": {
            "type": "string",
            "description": "Its page in Tooli."
          }
        },
        "required": [
          "id",
          "subject",
          "sentAt",
          "sender",
          "provider",
          "mailbox",
          "recipients",
          "shared",
          "views",
          "humanViews",
          "clicks",
          "replies",
          "firstViewedAt",
          "lastViewedAt",
          "lastClickedAt",
          "repliedAt",
          "lastPlace",
          "viewsByDay",
          "tags",
          "folder",
          "archivedAt",
          "page"
        ],
        "title": "Email",
        "description": "A tracked email."
      },
      "Recipient": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "description": "The address."
          },
          "kind": {
            "type": "string",
            "enum": [
              "to",
              "cc",
              "bcc"
            ],
            "description": "How it was sent: to, copied, or copied blind."
          },
          "views": {
            "type": "number",
            "description": "Views given to this address: only where the email went to it alone."
          },
          "humanViews": {
            "type": "number",
            "description": "Of those, the ones a person most likely made."
          },
          "firstViewedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first."
          },
          "lastViewedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "The latest."
          }
        },
        "required": [
          "address",
          "kind",
          "views",
          "humanViews",
          "firstViewedAt",
          "lastViewedAt"
        ],
        "title": "Recipient",
        "description": "One address a tracked email went to."
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What it is known by: `/api/v1/events/{id}` reads it."
          },
          "at": {
            "type": "string",
            "description": "When it happened."
          },
          "type": {
            "type": "string",
            "enum": [
              "email_view",
              "link_click",
              "document_view",
              "page_view",
              "reply"
            ],
            "description": "What it was."
          },
          "about": {
            "type": "string",
            "description": "What it happened to, by its own name: the email's subject, the short link, the document's name, the website's name."
          },
          "on": {
            "type": "string",
            "description": "The handle of what it happened to: an email's `id`, a link's or a document's `code`, a website's `key`."
          },
          "detail": {
            "type": [
              "string",
              "null"
            ],
            "description": "For an email's view, its recipient where the email went to one address; for a page view, the page's path; for a click, where the link sent it; for a reply, who sent it."
          },
          "class": {
            "type": "string",
            "enum": [
              "direct",
              "gmail_proxy",
              "apple_privacy",
              "datacenter",
              "vpn",
              "bot",
              "scanner",
              "prefetch",
              "sender_preview"
            ],
            "description": "What Tooli took the request to be."
          },
          "automated": {
            "type": "boolean",
            "description": "Its class is one a machine most likely makes."
          },
          "confidence": {
            "type": "number",
            "description": "How sure the class is, from 0 to 100."
          },
          "place": {
            "type": "object",
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The country, as a two-letter code."
              },
              "region": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The region."
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The city."
              }
            },
            "required": [
              "country",
              "region",
              "city"
            ],
            "description": "Where it came from; nulls where a mail service's proxy hid it."
          },
          "network": {
            "type": [
              "string",
              "null"
            ],
            "description": "The network it came from."
          },
          "ipFamily": {
            "type": [
              "number",
              "null"
            ],
            "enum": [
              4,
              6,
              null
            ],
            "description": "`4` or `6`: whether it came over IPv4 or IPv6."
          },
          "client": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the client said it was (its user agent)."
          },
          "archived": {
            "type": "boolean",
            "description": "It is kept only in the archive now: it left the database after it was copied."
          }
        },
        "required": [
          "id",
          "at",
          "type",
          "about",
          "on",
          "detail",
          "class",
          "automated",
          "confidence",
          "place",
          "network",
          "ipFamily",
          "client",
          "archived"
        ],
        "title": "Event",
        "description": "One request Tooli stored, or a reply it noticed: a row of the Event log, and of a record's views or clicks."
      },
      "Link": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "What it is known by: the part after the short-link address."
          },
          "url": {
            "type": "string",
            "description": "The whole short link."
          },
          "destination": {
            "type": "string",
            "description": "Where it sends people now."
          },
          "sentBy": {
            "type": "string",
            "enum": [
              "anywhere",
              "whatsapp",
              "sms",
              "email"
            ],
            "description": "Where it was made to be sent."
          },
          "shared": {
            "type": "boolean",
            "description": "Shared with the organisation."
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it was archived; null while it isn't."
          },
          "clicks": {
            "type": "number",
            "description": "Every click, a machine's too."
          },
          "visitors": {
            "type": "number",
            "description": "Different visitors among the clicks a person most likely made."
          },
          "automatedClicks": {
            "type": "number",
            "description": "The clicks a machine most likely made. They are in `clicks` too."
          },
          "firstClickedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its first click."
          },
          "lastClickedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its latest click."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was made."
          },
          "madeBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who made it: a person's name, or a key's."
          },
          "mailbox": {
            "type": [
              "string",
              "null"
            ],
            "description": "The shared mailbox it was made for, by its name; null for a person's own."
          },
          "page": {
            "type": "string",
            "description": "Its page in Tooli."
          }
        },
        "required": [
          "code",
          "url",
          "destination",
          "sentBy",
          "shared",
          "archivedAt",
          "clicks",
          "visitors",
          "automatedClicks",
          "firstClickedAt",
          "lastClickedAt",
          "createdAt",
          "madeBy",
          "mailbox",
          "page"
        ],
        "title": "Link",
        "description": "A short link."
      },
      "Document": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "What it is known by: what follows `/d/` in its address, the same value a `document.viewed` webhook carries."
          },
          "url": {
            "type": "string",
            "description": "The whole address a reader opens."
          },
          "name": {
            "type": "string",
            "description": "Its name."
          },
          "pages": {
            "type": [
              "number",
              "null"
            ],
            "description": "Its pages; null when they couldn't be counted."
          },
          "size": {
            "type": "number",
            "description": "Its size, in bytes."
          },
          "version": {
            "type": "number",
            "description": "Which file readers get: 1 for the first, one more each time the file is replaced."
          },
          "shared": {
            "type": "boolean",
            "description": "Shared with the organisation."
          },
          "downloadsAllowed": {
            "type": "boolean",
            "description": "Readers may download it."
          },
          "addedBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who added it: a person's name, or a key's."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was added."
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it was archived; null while it isn't."
          },
          "views": {
            "type": "number",
            "description": "Every answered request for its page, a machine's too; a signed-in person's own preview is left out."
          },
          "automatedViews": {
            "type": "number",
            "description": "The views a machine most likely made. They are in `views` too."
          },
          "people": {
            "type": "number",
            "description": "Different visitors among the views a person most likely made, told apart by device and network."
          },
          "timedViews": {
            "type": "number",
            "description": "The views whose time was reported."
          },
          "averageReadSeconds": {
            "type": [
              "number",
              "null"
            ],
            "description": "What one of those took on average, in seconds; null while none was."
          },
          "furthestPage": {
            "type": [
              "number",
              "null"
            ],
            "description": "The furthest page anyone had on screen for a second or more."
          },
          "readThrough": {
            "type": [
              "number",
              "null"
            ],
            "description": "That as a share of its pages, from 0 to 100."
          },
          "downloads": {
            "type": "number",
            "description": "Its downloads."
          },
          "lastViewedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its latest view."
          },
          "viewsByDay": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "Views on each of the last seven days (UTC), oldest first."
          },
          "page": {
            "type": "string",
            "description": "Its page in Tooli."
          }
        },
        "required": [
          "code",
          "url",
          "name",
          "pages",
          "size",
          "version",
          "shared",
          "downloadsAllowed",
          "addedBy",
          "createdAt",
          "archivedAt",
          "views",
          "automatedViews",
          "people",
          "timedViews",
          "averageReadSeconds",
          "furthestPage",
          "readThrough",
          "downloads",
          "lastViewedAt",
          "viewsByDay",
          "page"
        ],
        "title": "Document",
        "description": "A hosted document. Nobody who viewed it is named."
      },
      "Website": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "What it is known by: its site key, the one its snippet carries."
          },
          "name": {
            "type": "string",
            "description": "Its name."
          },
          "origins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The origins that may report for it, the first one first."
          },
          "state": {
            "type": "string",
            "enum": [
              "receiving",
              "none",
              "paused"
            ],
            "description": "Receiving page views now, with none yet, or paused."
          },
          "pageViews": {
            "type": "number",
            "description": "Every page view stored for it, a machine's too."
          },
          "pageViews24h": {
            "type": "number",
            "description": "Page views in the last 24 hours."
          },
          "visitors24h": {
            "type": "number",
            "description": "Different visitors among those a person most likely made."
          },
          "lastPageViewAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its latest page view."
          },
          "addedBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who added it: a person's name, or a key's."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was added."
          },
          "page": {
            "type": "string",
            "description": "Its page in Tooli."
          }
        },
        "required": [
          "key",
          "name",
          "origins",
          "state",
          "pageViews",
          "pageViews24h",
          "visitors24h",
          "lastPageViewAt",
          "addedBy",
          "createdAt",
          "page"
        ],
        "title": "Website",
        "description": "A tracked website."
      },
      "Visit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Its first page view's id, as an event's."
          },
          "at": {
            "type": "string",
            "description": "When it began."
          },
          "endedAt": {
            "type": "string",
            "description": "When its latest page view was."
          },
          "pages": {
            "type": "number",
            "description": "Its page views."
          },
          "seconds": {
            "type": "number",
            "description": "Time looked at, over its timed page views."
          },
          "entryPath": {
            "type": "string",
            "description": "The first page's path."
          },
          "entryTitle": {
            "type": "string",
            "description": "The first page's title."
          },
          "referrer": {
            "type": "string",
            "description": "The host of the page that led to it; empty when typed or unknown."
          },
          "class": {
            "type": "string",
            "enum": [
              "direct",
              "gmail_proxy",
              "apple_privacy",
              "datacenter",
              "vpn",
              "bot",
              "scanner",
              "prefetch",
              "sender_preview"
            ],
            "description": "What Tooli took its first request to be."
          },
          "automated": {
            "type": "boolean",
            "description": "That class is one a machine most likely makes."
          },
          "place": {
            "type": "object",
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The country, as a two-letter code."
              },
              "region": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The region."
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The city."
              }
            },
            "required": [
              "country",
              "region",
              "city"
            ],
            "description": "Where it came from."
          },
          "network": {
            "type": [
              "string",
              "null"
            ],
            "description": "The network it came from."
          },
          "client": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the browser said it was."
          },
          "visitor": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "The visitor's id, for `/api/v1/visitors/{id}`."
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Who Tooli takes it to be, where the caller may see it."
              }
            },
            "required": [
              "id",
              "name"
            ],
            "description": "Its visitor."
          }
        },
        "required": [
          "id",
          "at",
          "endedAt",
          "pages",
          "seconds",
          "entryPath",
          "entryTitle",
          "referrer",
          "class",
          "automated",
          "place",
          "network",
          "client",
          "visitor"
        ],
        "title": "Visit",
        "description": "A visit to a website: page views close together from one visitor."
      },
      "Visitor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What its page's address is called by: `/api/v1/visitors/{id}` reads it. It is random, and tells nothing of the device or network."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who Tooli takes it to be, where the caller may see why; null when it isn't named for them."
          },
          "how": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "certain",
              "probable",
              null
            ],
            "description": "How sure: `certain` or `probable`."
          },
          "firstSeenAt": {
            "type": "string",
            "description": "When it was first seen, of what the caller may see."
          },
          "lastSeenAt": {
            "type": "string",
            "description": "When it was last seen."
          },
          "clicks": {
            "type": "number",
            "description": "Its clicks."
          },
          "documentViews": {
            "type": "number",
            "description": "Its document views."
          },
          "pageViews": {
            "type": "number",
            "description": "Its page views."
          },
          "automated": {
            "type": "boolean",
            "description": "Its latest request was most likely a machine's."
          },
          "place": {
            "type": "object",
            "properties": {
              "country": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The country, as a two-letter code."
              },
              "region": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The region."
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The city."
              },
              "estimated": {
                "type": "boolean",
                "description": "Always true, kept for programs that read it."
              }
            },
            "required": [
              "country",
              "region",
              "city",
              "estimated"
            ],
            "description": "Where its latest request came from."
          },
          "network": {
            "type": [
              "string",
              "null"
            ],
            "description": "The network its latest request came from."
          },
          "browser": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its browser."
          },
          "system": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its operating system."
          },
          "website": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "key": {
                "type": "string",
                "description": "The website's key."
              },
              "name": {
                "type": "string",
                "description": "The website's name."
              }
            },
            "required": [
              "key",
              "name"
            ],
            "description": "The website of its latest page view."
          },
          "page": {
            "type": "string",
            "description": "Its page in Tooli."
          }
        },
        "required": [
          "id",
          "name",
          "how",
          "firstSeenAt",
          "lastSeenAt",
          "clicks",
          "documentViews",
          "pageViews",
          "automated",
          "place",
          "network",
          "browser",
          "system",
          "website",
          "page"
        ],
        "title": "Visitor",
        "description": "One device on one network, or a browser by its own mark, named only as the app names it for the caller."
      },
      "Mailbox": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What it is known by."
          },
          "name": {
            "type": "string",
            "description": "Its name."
          },
          "address": {
            "type": "string",
            "description": "Its address."
          },
          "provider": {
            "type": "string",
            "description": "The mail service it was last sent from; empty before anyone has."
          },
          "seenBy": {
            "type": "string",
            "enum": [
              "chosen",
              "everyone"
            ],
            "description": "Who sees it: the people and teams chosen (`chosen`), or everyone (`everyone`)."
          },
          "page": {
            "type": "string",
            "description": "Its page in Tooli."
          }
        },
        "required": [
          "id",
          "name",
          "address",
          "provider",
          "seenBy",
          "page"
        ],
        "title": "Shared mailbox",
        "description": "A mailbox the organisation owns, shared with people and teams."
      },
      "Member": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What they are known by: the lists' `owner` filter takes it."
          },
          "name": {
            "type": "string",
            "description": "Their name."
          },
          "email": {
            "type": "string",
            "description": "Their email address."
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member",
              "viewer"
            ],
            "description": "Their role."
          },
          "team": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "The team's id."
              },
              "name": {
                "type": "string",
                "description": "Its name."
              }
            },
            "required": [
              "id",
              "name"
            ],
            "description": "Their team."
          },
          "joinedAt": {
            "type": "string",
            "description": "When they joined."
          },
          "lastActiveAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When they last used Tooli."
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "role",
          "team",
          "joinedAt",
          "lastActiveAt"
        ],
        "title": "Member",
        "description": "A person in the organisation."
      },
      "Team": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What it is known by."
          },
          "name": {
            "type": "string",
            "description": "Its name."
          },
          "lead": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its lead's name."
          },
          "members": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The member's id."
                },
                "name": {
                  "type": "string",
                  "description": "Their name."
                },
                "email": {
                  "type": "string",
                  "description": "Their email address."
                }
              },
              "required": [
                "id",
                "name",
                "email"
              ]
            },
            "description": "Its members."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was made."
          }
        },
        "required": [
          "id",
          "name",
          "lead",
          "members",
          "createdAt"
        ],
        "title": "Team",
        "description": "A team in the organisation."
      },
      "Activity": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string",
            "description": "When."
          },
          "by": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who: a person's name, or a key's; null for Tooli itself."
          },
          "action": {
            "type": "string",
            "description": "What was done, such as `link.archive`."
          },
          "targetType": {
            "type": [
              "string",
              "null"
            ],
            "description": "What kind of thing it was done to."
          },
          "details": {
            "type": "object",
            "additionalProperties": true,
            "description": "What it was, as Activity shows it."
          }
        },
        "required": [
          "at",
          "by",
          "action",
          "targetType",
          "details"
        ],
        "title": "Activity",
        "description": "One change, as Organisation → Activity lists it."
      },
      "NeverTrack": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What it is known by: remove it with `DELETE /api/v1/never-track/{id}`."
          },
          "kind": {
            "type": "string",
            "enum": [
              "address",
              "domain"
            ],
            "description": "An address or a domain."
          },
          "value": {
            "type": "string",
            "description": "The address or domain, in lower case."
          },
          "list": {
            "type": "string",
            "enum": [
              "own",
              "organisation"
            ],
            "description": "Whose list it is on: the person's own, or the organisation's."
          },
          "addedBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who added it; null for a key."
          },
          "addedAt": {
            "type": "string",
            "description": "When."
          }
        },
        "required": [
          "id",
          "kind",
          "value",
          "list",
          "addedBy",
          "addedAt"
        ],
        "title": "Never-track entry",
        "description": "An address or a domain that is never tracked."
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "What it is known by."
          },
          "url": {
            "type": "string",
            "description": "Where it sends."
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "email.viewed",
                "link.clicked",
                "document.viewed",
                "website.visited",
                "reply.received"
              ]
            },
            "description": "The events it sends."
          },
          "state": {
            "type": "string",
            "enum": [
              "on",
              "paused",
              "off"
            ],
            "description": "Sending (`on`), paused, or switched off by Tooli after failing for three days (`off`)."
          },
          "lastSentAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it last sent."
          },
          "lastOkAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When a delivery last got through."
          },
          "failsInRow": {
            "type": "number",
            "description": "Failed attempts since the last one that got through."
          },
          "secretEnding": {
            "type": "string",
            "description": "Its signing secret's last four characters."
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who added it: a person's name, or a key's."
          },
          "createdAt": {
            "type": "string",
            "description": "When."
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "state",
          "lastSentAt",
          "lastOkAt",
          "failsInRow",
          "secretEnding",
          "createdBy",
          "createdAt"
        ],
        "title": "Webhook",
        "description": "An address the organisation's events are sent to."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthenticated",
                  "forbidden",
                  "not_found",
                  "invalid_request",
                  "conflict",
                  "limit_reached",
                  "rate_limited",
                  "feature_off",
                  "not_on_plan",
                  "unavailable",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {},
              "requestId": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "requestId"
            ]
          }
        },
        "required": [
          "error"
        ]
      }
    }
  },
  "paths": {
    "/api/v1/organization": {
      "get": {
        "operationId": "organization",
        "summary": "The organisation",
        "description": "Your organisation's name, its plan, and what it has used of each limit this month.\n\nOpen to every key. For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "organisation"
        ],
        "x-tooli-area": null,
        "parameters": [],
        "responses": {
          "200": {
            "description": "The organisation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organization"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emails": {
      "get": {
        "operationId": "emails",
        "summary": "Tracked emails",
        "description": "Tracked emails, newest first unless sorted otherwise, with the Tracked emails page's own filters.\n\nKey area: Tracked emails and views (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of a subject, a recipient's address or a tag's name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "`viewed`, `none` (not viewed), `automated` (only automated views so far) or `replied`.",
            "schema": {
              "type": "string",
              "enum": [
                "viewed",
                "none",
                "automated",
                "replied"
              ]
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Only those sent at or after this time.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "Only those sent through this mail service, as an email's `provider` names it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "required": false,
            "description": "Only those of this member, by their id from `/api/v1/members`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mailbox",
            "in": "query",
            "required": false,
            "description": "Only those of this shared mailbox, by its id from `/api/v1/mailboxes`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "description": "Only those with this tag, by its name or its id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "folder",
            "in": "query",
            "required": false,
            "description": "Only those in this folder, by its name or its id; `none` for those in no folder; `archived` for the archived emails instead.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "What to sort by: when it was sent, its subject, views, clicks, or its latest click.",
            "schema": {
              "type": "string",
              "enum": [
                "sent",
                "subject",
                "views",
                "clicks",
                "lastClicked"
              ]
            }
          },
          {
            "name": "dir",
            "in": "query",
            "required": false,
            "description": "Which way: `asc` or `desc`.",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tracked emails",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Email"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emails/{id}": {
      "get": {
        "operationId": "email",
        "summary": "One tracked email",
        "description": "One tracked email, with each recipient's views.\n\nKey area: Tracked emails and views (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One tracked email",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "$ref": "#/components/schemas/Email"
                    },
                    "recipients": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Recipient"
                      },
                      "description": "Each address it went to, in order, with its views where it went to that address alone."
                    }
                  },
                  "required": [
                    "email",
                    "recipients"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emails/{id}/views": {
      "get": {
        "operationId": "emailViews",
        "summary": "An email's views",
        "description": "Every counted view of one tracked email, newest first. A view names its recipient only where the email went to one address: a message carries one image, the same for everyone it went to.\n\nKey area: Tracked emails and views (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An email's views",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emails/{id}/tags": {
      "put": {
        "operationId": "emailTags",
        "summary": "Tag an email",
        "description": "Sets a tracked email's tags: the list given replaces the ones it had. A tag goes on an email when it is the sender's own or their team's.\n\nKey area: Tracked emails and views (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Tag names (any case) or ids. The list replaces the email's tags; an empty list takes them all off."
                  }
                },
                "required": [
                  "tags"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tag an email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Email"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emails/{id}/folder": {
      "put": {
        "operationId": "emailFolder",
        "summary": "File an email",
        "description": "Puts a tracked email in a folder, or takes it out of its folder with `null`.\n\nKey area: Tracked emails and views (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "folder": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A folder's name or id, or `null` for no folder."
                  }
                },
                "required": [
                  "folder"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File an email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Email"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emails/{id}/archived": {
      "put": {
        "operationId": "emailArchived",
        "summary": "Archive an email",
        "description": "Archives a tracked email, or brings it back. It keeps all its views.\n\nKey area: Tracked emails and views (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "archived": {
                    "type": "boolean",
                    "description": "`true` to archive, `false` to bring back."
                  }
                },
                "required": [
                  "archived"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Archive an email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Email"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/never-track": {
      "get": {
        "operationId": "neverTrack",
        "summary": "Never-track list",
        "description": "The addresses and domains never tracked: the organisation's list, and for an app a person connected, their own as well.\n\nKey area: Tracked emails and views (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Never-track list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NeverTrack"
                      },
                      "description": "The page's records."
                    }
                  },
                  "required": [
                    "rows"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "neverTrackAdd",
        "summary": "Never track an address",
        "description": "Adds an address or a domain to a never-track list. What a key adds goes on the organisation's list.\n\nKey area: Tracked emails and views (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Send an Idempotency-Key header (see Sending a change twice).",
            "schema": {
              "type": "string",
              "pattern": "^[\\w-]{16,64}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "description": "An email address, or a domain such as `example.com`."
                  },
                  "list": {
                    "type": "string",
                    "enum": [
                      "own",
                      "organisation"
                    ],
                    "description": "`own`: the person's own list (not for a key); `organisation`: everyone's (admins and the owner). A key's go on the organisation's."
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Never track an address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NeverTrack"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/never-track/{id}": {
      "delete": {
        "operationId": "neverTrackRemove",
        "summary": "Track an address again",
        "description": "Takes an entry off a never-track list.\n\nKey area: Tracked emails and views (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "emails"
        ],
        "x-tooli-area": "emails",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Track an address again"
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/links": {
      "get": {
        "operationId": "links",
        "summary": "Short links",
        "description": "Short links, newest first, with the Links page's own filters.\n\nKey area: Links and clicks (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "links"
        ],
        "x-tooli-area": "links",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of a slug or a destination; a whole short link finds that link.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sentBy",
            "in": "query",
            "required": false,
            "description": "Only links made to be sent this way.",
            "schema": {
              "type": "string",
              "enum": [
                "anywhere",
                "whatsapp",
                "sms",
                "email"
              ]
            }
          },
          {
            "name": "owner",
            "in": "query",
            "required": false,
            "description": "Only those of this member, by their id from `/api/v1/members`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mailbox",
            "in": "query",
            "required": false,
            "description": "Only those of this shared mailbox, by its id from `/api/v1/mailboxes`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "`archived`: the archived links instead of the working ones.",
            "schema": {
              "type": "string",
              "enum": [
                "archived"
              ]
            }
          },
          {
            "name": "clicked",
            "in": "query",
            "required": false,
            "description": "`yes`: only links that have been clicked; `no`: only those never clicked.",
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Short links",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Link"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    },
                    "clicks": {
                      "type": "number",
                      "description": "The clicks of every link that matches, added up."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total",
                    "clicks"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "linkCreate",
        "summary": "Make a short link",
        "description": "Makes a short link to a destination, with a slug of your own if you want one. A link a key makes is named as the key's.\n\nKey area: Links and clicks (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "links"
        ],
        "x-tooli-area": "links",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Send an Idempotency-Key header (see Sending a change twice).",
            "schema": {
              "type": "string",
              "pattern": "^[\\w-]{16,64}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "destination": {
                    "type": "string",
                    "description": "The `https` address clicks are sent to."
                  },
                  "slug": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The part after the short-link address, if you want your own; a random one if left out."
                  },
                  "sentBy": {
                    "type": "string",
                    "enum": [
                      "anywhere",
                      "whatsapp",
                      "sms"
                    ],
                    "description": "Where it will be sent: `anywhere` unless said, `whatsapp` or `sms`."
                  },
                  "mailbox": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The shared mailbox it is made for, by its id; a person must be one of its senders. Not for a key."
                  }
                },
                "required": [
                  "destination"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Make a short link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Link"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/links/{code}": {
      "get": {
        "operationId": "link",
        "summary": "One short link",
        "description": "One short link, with every destination it has had.\n\nKey area: Links and clicks (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "links"
        ],
        "x-tooli-area": "links",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "The link's or document's code, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One short link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "link": {
                      "$ref": "#/components/schemas/Link"
                    },
                    "destinations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "destination": {
                            "type": "string",
                            "description": "Where its clicks were sent."
                          },
                          "setAt": {
                            "type": "string",
                            "description": "When it was set."
                          },
                          "setBy": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Who set it: a person's name, or a key's."
                          },
                          "clicks": {
                            "type": "number",
                            "description": "The clicks sent there while it was set."
                          }
                        },
                        "required": [
                          "destination",
                          "setAt",
                          "setBy",
                          "clicks"
                        ]
                      },
                      "description": "Every destination it has had, newest first."
                    }
                  },
                  "required": [
                    "link",
                    "destinations"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/links/{code}/clicks": {
      "get": {
        "operationId": "linkClicks",
        "summary": "A link's clicks",
        "description": "Every click on one short link, newest first, a machine's too, each with its class.\n\nKey area: Links and clicks (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "links"
        ],
        "x-tooli-area": "links",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "The link's or document's code, as its list gives it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of an IP address, a network's name, a city or a country code.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "who",
            "in": "query",
            "required": false,
            "description": "`people`: leave out what a machine most likely made; `automated`: only that.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "automated"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A link's clicks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/links/{code}/destination": {
      "put": {
        "operationId": "linkDestination",
        "summary": "Change a link's destination",
        "description": "Sends a short link's clicks to another destination from now on. Clicks so far keep the destination they had.\n\nKey area: Links and clicks (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "links"
        ],
        "x-tooli-area": "links",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "The link's or document's code, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "destination": {
                    "type": "string",
                    "description": "The `https` address clicks are sent to."
                  }
                },
                "required": [
                  "destination"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Change a link's destination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Link"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/links/{code}/archived": {
      "put": {
        "operationId": "linkArchived",
        "summary": "Archive a link",
        "description": "Archives a short link, or brings it back. An archived link still sends people on, and keeps its clicks.\n\nKey area: Links and clicks (read and change). For an app a person connected through MCP: members, admins and the owner.",
        "tags": [
          "links"
        ],
        "x-tooli-area": "links",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "The link's or document's code, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "archived": {
                    "type": "boolean",
                    "description": "`true` to archive, `false` to bring back."
                  }
                },
                "required": [
                  "archived"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Archive a link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Link"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents": {
      "get": {
        "operationId": "documents",
        "summary": "Documents",
        "description": "Hosted documents, newest first, with the figures the Documents page shows and its own filters (less the one that takes a person).\n\nKey area: Documents (read). For an app a person connected through MCP: anyone in the organisation. Needs the platform's `documents` switch on.",
        "tags": [
          "documents"
        ],
        "x-tooli-area": "documents",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of a document's name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewed",
            "in": "query",
            "required": false,
            "description": "`yes`: only documents viewed; `no`: only those never viewed.",
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "`archived`: the archived documents instead of the working ones.",
            "schema": {
              "type": "string",
              "enum": [
                "archived"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Documents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Document"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    },
                    "views": {
                      "type": "number",
                      "description": "The views of every document that matches, added up."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total",
                    "views"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "documentUpload",
        "summary": "Upload a document",
        "description": "Adds a PDF as a hosted document: the file is the request's body (`Content-Type: application/pdf`), its name in `name`.\n\nKey area: Documents (read and change). For an app a person connected through MCP: members, admins and the owner. Needs the platform's `documents` switch on.",
        "tags": [
          "documents"
        ],
        "x-tooli-area": "documents",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "The document's name, as readers will see it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "description": "`no` stops readers downloading it; `yes` unless said.",
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Send an Idempotency-Key header (see Sending a change twice).",
            "schema": {
              "type": "string",
              "pattern": "^[\\w-]{16,64}$"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/pdf": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Upload a document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/{code}": {
      "get": {
        "operationId": "document",
        "summary": "One document",
        "description": "One hosted document, with the time spent on each page of the file readers get now.\n\nKey area: Documents (read). For an app a person connected through MCP: anyone in the organisation. Needs the platform's `documents` switch on.",
        "tags": [
          "documents"
        ],
        "x-tooli-area": "documents",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "The link's or document's code, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "document": {
                      "$ref": "#/components/schemas/Document"
                    },
                    "pageTimes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "number",
                            "description": "The page."
                          },
                          "seconds": {
                            "type": "number",
                            "description": "Seconds on it."
                          }
                        },
                        "required": [
                          "page",
                          "seconds"
                        ]
                      },
                      "description": "Time on each page of the file readers get now, every counted view together. Pages nobody stayed on are left out."
                    }
                  },
                  "required": [
                    "document",
                    "pageTimes"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents/{code}/views": {
      "get": {
        "operationId": "documentViews",
        "summary": "A document's views",
        "description": "Every view of one hosted document, newest first, a machine's too.\n\nKey area: Documents (read). For an app a person connected through MCP: anyone in the organisation. Needs the platform's `documents` switch on.",
        "tags": [
          "documents"
        ],
        "x-tooli-area": "documents",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "The link's or document's code, as its list gives it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of an IP address, a network's name, a city or a country code.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "who",
            "in": "query",
            "required": false,
            "description": "`people`: leave out what a machine most likely made; `automated`: only that.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "automated"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A document's views",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/websites": {
      "get": {
        "operationId": "websites",
        "summary": "Websites",
        "description": "Tracked websites, busiest in the last 24 hours first. A handful for each organisation: no pages.\n\nKey area: Websites and visitors (read). For an app a person connected through MCP: anyone in the organisation. Needs the platform's `websites` switch on.",
        "tags": [
          "websites"
        ],
        "x-tooli-area": "websites",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of a name or an origin.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Only websites receiving page views now, with none yet, or paused.",
            "schema": {
              "type": "string",
              "enum": [
                "receiving",
                "none",
                "paused"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Websites",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Website"
                      },
                      "description": "The page's records."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    }
                  },
                  "required": [
                    "rows",
                    "total"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "websiteAdd",
        "summary": "Add a website",
        "description": "Adds a website to track, by its name and the origins it is served from. Its snippet is on its page in the app.\n\nKey area: Websites and visitors (read and change). For an app a person connected through MCP: admins and the owner. Needs the platform's `websites` switch on.",
        "tags": [
          "websites"
        ],
        "x-tooli-area": "websites",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Send an Idempotency-Key header (see Sending a change twice).",
            "schema": {
              "type": "string",
              "pattern": "^[\\w-]{16,64}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Its name, as the app shows it."
                  },
                  "origins": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The addresses it is served from, such as `https://www.example.com`, the first one first."
                  }
                },
                "required": [
                  "name",
                  "origins"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Add a website",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Website"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/websites/{key}": {
      "get": {
        "operationId": "website",
        "summary": "One website",
        "description": "One website's figures for a period, as its page shows them: visitors, visits, page views, time, its top pages and where visits came from.\n\nKey area: Websites and visitors (read). For an app a person connected through MCP: anyone in the organisation. Needs the platform's `websites` switch on.",
        "tags": [
          "websites"
        ],
        "x-tooli-area": "websites",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "The website's key, as the Websites list gives it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "`today`, `7d` (unless said) or `30d`, in the caller's days.",
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "7d",
                "30d"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One website",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "website": {
                      "$ref": "#/components/schemas/Website"
                    },
                    "range": {
                      "type": "string",
                      "enum": [
                        "today",
                        "7d",
                        "30d"
                      ],
                      "description": "The period."
                    },
                    "from": {
                      "type": "string",
                      "description": "When the period began."
                    },
                    "to": {
                      "type": "string",
                      "description": "When it ends."
                    },
                    "figures": {
                      "type": "object",
                      "properties": {
                        "visitors": {
                          "type": "number",
                          "description": "Different visitors among the visits a person most likely made."
                        },
                        "newVisitors": {
                          "type": "number",
                          "description": "Of those, the ones never seen on this website before the period."
                        },
                        "visits": {
                          "type": "number",
                          "description": "Visits a person most likely made."
                        },
                        "onePage": {
                          "type": "number",
                          "description": "Of those, the ones with one page view."
                        },
                        "visitPages": {
                          "type": "number",
                          "description": "Page views in those visits."
                        },
                        "pageViews": {
                          "type": "number",
                          "description": "Every page view in the period, a machine's too."
                        },
                        "automatedViews": {
                          "type": "number",
                          "description": "The page views a machine most likely made. They are in `pageViews` too."
                        },
                        "seconds": {
                          "type": "number",
                          "description": "Time looked at, over the page views that were timed."
                        },
                        "timed": {
                          "type": "number",
                          "description": "How many page views were timed."
                        }
                      },
                      "required": [
                        "visitors",
                        "newVisitors",
                        "visits",
                        "onePage",
                        "visitPages",
                        "pageViews",
                        "automatedViews",
                        "seconds",
                        "timed"
                      ],
                      "description": "The period's figures."
                    },
                    "topPages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string",
                            "description": "The page's path."
                          },
                          "title": {
                            "type": "string",
                            "description": "The title it had most recently."
                          },
                          "views": {
                            "type": "number",
                            "description": "Its page views."
                          },
                          "visitors": {
                            "type": "number",
                            "description": "Different visitors among the page views a person most likely made."
                          }
                        },
                        "required": [
                          "path",
                          "title",
                          "views",
                          "visitors"
                        ]
                      },
                      "description": "The pages viewed most in the period."
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "referrer": {
                            "type": "string",
                            "description": "The host of the page that led there; empty when typed or unknown."
                          },
                          "visits": {
                            "type": "number",
                            "description": "Visits that came from there."
                          }
                        },
                        "required": [
                          "referrer",
                          "visits"
                        ]
                      },
                      "description": "Where visits came from most in the period."
                    }
                  },
                  "required": [
                    "website",
                    "range",
                    "from",
                    "to",
                    "figures",
                    "topPages",
                    "sources"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/websites/{key}/visits": {
      "get": {
        "operationId": "websiteVisits",
        "summary": "A website's visits",
        "description": "A website's visits in a period, newest first, each with its visitor where the key or person may see who it is.\n\nKey area: Websites and visitors (read). For an app a person connected through MCP: anyone in the organisation. Needs the platform's `websites` switch on.",
        "tags": [
          "websites"
        ],
        "x-tooli-area": "websites",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "The website's key, as the Websites list gives it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "`today`, `7d` (unless said) or `30d`, in the caller's days.",
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "7d",
                "30d"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of a page's path or title, a network's name or a city.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "who",
            "in": "query",
            "required": false,
            "description": "`people`: leave out what a machine most likely made; `automated`: only that.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "automated"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A website's visits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Visit"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/visitors": {
      "get": {
        "operationId": "visitors",
        "summary": "Visitors",
        "description": "Visitors, newest seen first, with the Visitors page's own filters. A visitor is named only as the app names it for the caller.\n\nKey area: Websites and visitors (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "websites"
        ],
        "x-tooli-area": "websites",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of a name, a place, a network, a browser or an IP address.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "named",
            "in": "query",
            "required": false,
            "description": "`yes`: only visitors Tooli names for the caller; `no`: only those it doesn't.",
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "activity",
            "in": "query",
            "required": false,
            "description": "Only visitors who did this.",
            "schema": {
              "type": "string",
              "enum": [
                "clicks",
                "pages",
                "documents"
              ]
            }
          },
          {
            "name": "site",
            "in": "query",
            "required": false,
            "description": "Only visitors who viewed a page of this website, by its key.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "seen",
            "in": "query",
            "required": false,
            "description": "Only visitors seen today, in the last 7 or the last 30 days.",
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "7d",
                "30d"
              ]
            }
          },
          {
            "name": "who",
            "in": "query",
            "required": false,
            "description": "`people`: leave out what a machine most likely made; `automated`: only that.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "automated"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Visitors",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Visitor"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    },
                    "total": {
                      "type": "number",
                      "description": "How many match, across every page."
                    }
                  },
                  "required": [
                    "rows",
                    "next",
                    "total"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/visitors/{id}": {
      "get": {
        "operationId": "visitor",
        "summary": "One visitor",
        "description": "One visitor: who Tooli takes it to be and why, as the caller may see it, and what it has done.\n\nKey area: Websites and visitors (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "websites"
        ],
        "x-tooli-area": "websites",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One visitor",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "visitor": {
                      "$ref": "#/components/schemas/Visitor"
                    },
                    "why": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "none",
                        "several",
                        "refused",
                        null
                      ],
                      "description": "Why it isn't named, when it isn't: nothing ties it to anyone (`none`), it is tied to several people (`several`), or someone said it isn't who Tooli thought (`refused`)."
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "address": {
                            "type": "string",
                            "description": "The person's address."
                          },
                          "how": {
                            "type": "string",
                            "enum": [
                              "certain",
                              "probable"
                            ],
                            "description": "How sure: `certain` or `probable`."
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "same_device",
                              "other_device",
                              "vpn",
                              "tied"
                            ],
                            "description": "This device viewed it (`same_device`), another device on this network just before (`other_device`), this device through a VPN (`vpn`), or a visitor tied to this one (`tied`)."
                          },
                          "email": {
                            "type": "string",
                            "description": "The email's id."
                          },
                          "subject": {
                            "type": "string",
                            "description": "The email's subject."
                          },
                          "viewedAt": {
                            "type": "string",
                            "description": "When it was viewed."
                          }
                        },
                        "required": [
                          "address",
                          "how",
                          "kind",
                          "email",
                          "subject",
                          "viewedAt"
                        ]
                      },
                      "description": "The tracked emails that tie it to a person, as the caller may see them."
                    },
                    "facts": {
                      "type": "object",
                      "properties": {
                        "emailsViewed": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Emails sent to the named person alone that were viewed; null when it isn't named."
                        },
                        "emailsAlone": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Emails sent to the named person alone; null when it isn't named."
                        },
                        "links": {
                          "type": "number",
                          "description": "Different links it clicked."
                        },
                        "visits": {
                          "type": "number",
                          "description": "Its visits to the organisation's websites."
                        },
                        "documentSeconds": {
                          "type": "number",
                          "description": "Seconds it spent on documents."
                        }
                      },
                      "required": [
                        "emailsViewed",
                        "emailsAlone",
                        "links",
                        "visits",
                        "documentSeconds"
                      ],
                      "description": "What it has done, of what the caller may see."
                    }
                  },
                  "required": [
                    "visitor",
                    "why",
                    "evidence",
                    "facts"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/visitors/{id}/activity": {
      "get": {
        "operationId": "visitorActivity",
        "summary": "A visitor's activity",
        "description": "What one visitor did, newest first: views, clicks, document views and page views.\n\nKey area: Websites and visitors (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "websites"
        ],
        "x-tooli-area": "websites",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Only this kind of activity: clicks, document views, page views or email views.",
            "schema": {
              "type": "string",
              "enum": [
                "click",
                "doc_view",
                "web_hit",
                "open"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A visitor's activity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    }
                  },
                  "required": [
                    "rows",
                    "next"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes": {
      "get": {
        "operationId": "mailboxes",
        "summary": "Shared mailboxes",
        "description": "The shared mailboxes: every one for a key, which reads as an admin who sees every record; for an app a person connected, the ones they see.\n\nKey area: Mailboxes (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "mailboxes"
        ],
        "x-tooli-area": "mailboxes",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Shared mailboxes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Mailbox"
                      },
                      "description": "The page's records."
                    }
                  },
                  "required": [
                    "rows"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes/{id}": {
      "get": {
        "operationId": "mailbox",
        "summary": "One shared mailbox",
        "description": "One shared mailbox's figures, of what the caller sees, and who sent from it.\n\nKey area: Mailboxes (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "mailboxes"
        ],
        "x-tooli-area": "mailboxes",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One shared mailbox",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mailbox": {
                      "$ref": "#/components/schemas/Mailbox"
                    },
                    "facts": {
                      "type": "object",
                      "properties": {
                        "emails": {
                          "type": "number",
                          "description": "Tracked emails sent from it."
                        },
                        "emailsWeek": {
                          "type": "number",
                          "description": "Of those, the ones sent in the last seven days."
                        },
                        "viewed": {
                          "type": "number",
                          "description": "Of those, the ones viewed."
                        },
                        "views": {
                          "type": "number",
                          "description": "Their views."
                        },
                        "humanViews": {
                          "type": "number",
                          "description": "Of those, the ones a person most likely made."
                        },
                        "clicks": {
                          "type": "number",
                          "description": "Clicks on its links."
                        },
                        "links": {
                          "type": "number",
                          "description": "Links made for it."
                        },
                        "documents": {
                          "type": "number",
                          "description": "Documents sent from it."
                        },
                        "replies": {
                          "type": "number",
                          "description": "Replies to its emails."
                        },
                        "lastViewedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "When one of its emails was last viewed."
                        }
                      },
                      "required": [
                        "emails",
                        "emailsWeek",
                        "viewed",
                        "views",
                        "humanViews",
                        "clicks",
                        "links",
                        "documents",
                        "replies",
                        "lastViewedAt"
                      ],
                      "description": "Its figures, of what the caller sees."
                    },
                    "senders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Their name."
                          },
                          "emails": {
                            "type": "number",
                            "description": "The tracked emails they sent from it."
                          }
                        },
                        "required": [
                          "name",
                          "emails"
                        ]
                      },
                      "description": "Who sent from it, most first."
                    }
                  },
                  "required": [
                    "mailbox",
                    "facts",
                    "senders"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/members": {
      "get": {
        "operationId": "members",
        "summary": "Members",
        "description": "The organisation's members, with their role and team.\n\nKey area: Members and teams (read). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "members"
        ],
        "x-tooli-area": "members",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Members",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Member"
                      },
                      "description": "The page's records."
                    }
                  },
                  "required": [
                    "rows"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/teams": {
      "get": {
        "operationId": "teams",
        "summary": "Teams",
        "description": "The organisation's teams, with their lead and members.\n\nKey area: Members and teams (read). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "members"
        ],
        "x-tooli-area": "members",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Teams",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Team"
                      },
                      "description": "The page's records."
                    }
                  },
                  "required": [
                    "rows"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/activity": {
      "get": {
        "operationId": "activity",
        "summary": "Activity",
        "description": "Who changed what in the organisation, newest first, as Organisation → Activity lists it.\n\nKey area: Members and teams (read). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "members"
        ],
        "x-tooli-area": "members",
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "description": "Only changes of this kind, such as `link.archive` or `member.role`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "actor",
            "in": "query",
            "required": false,
            "description": "Only changes made by this member, by their id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Activity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Activity"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    }
                  },
                  "required": [
                    "rows",
                    "next"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/events": {
      "get": {
        "operationId": "events",
        "summary": "The Event log",
        "description": "Every view, click, document view, page view and reply, newest first, with the Event log's own search and filters: first the events still in the database, then those kept only in the archive, each marked `archived`.\n\nKey area: The Event log (read). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "events"
        ],
        "x-tooli-area": "events",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Only events of this kind.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "click",
                "doc_view",
                "web_hit",
                "reply"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Part of what an event is about, an IP address, a network or a place.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "class",
            "in": "query",
            "required": false,
            "description": "Only events of this class.",
            "schema": {
              "type": "string",
              "enum": [
                "direct",
                "gmail_proxy",
                "apple_privacy",
                "datacenter",
                "vpn",
                "bot",
                "scanner",
                "prefetch",
                "sender_preview"
              ]
            }
          },
          {
            "name": "family",
            "in": "query",
            "required": false,
            "description": "`4` or `6`: only requests that came over IPv4 or over IPv6.",
            "schema": {
              "type": "string",
              "enum": [
                "4",
                "6"
              ]
            }
          },
          {
            "name": "who",
            "in": "query",
            "required": false,
            "description": "`people`: leave out the classes where a machine most likely asked.",
            "schema": {
              "type": "string",
              "enum": [
                "people"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Event log",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      },
                      "description": "The page's records."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    }
                  },
                  "required": [
                    "rows",
                    "next"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/events/{id}": {
      "get": {
        "operationId": "event",
        "summary": "One event",
        "description": "One event of the Event log, with when it was stored and the rules that decided its class.\n\nKey area: The Event log (read). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "events"
        ],
        "x-tooli-area": "events",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One event",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "event": {
                      "$ref": "#/components/schemas/Event"
                    },
                    "storedAt": {
                      "type": "string",
                      "description": "When Tooli stored it."
                    },
                    "timeZone": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The time zone the request said it was in, where it did."
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "rule": {
                            "type": "string",
                            "description": "The rule."
                          },
                          "note": {
                            "type": "string",
                            "description": "What it found."
                          }
                        },
                        "required": [
                          "rule",
                          "note"
                        ]
                      },
                      "description": "The rules that matched, first the one that decided its class."
                    }
                  },
                  "required": [
                    "event",
                    "storedAt",
                    "timeZone",
                    "evidence"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/dashboard": {
      "get": {
        "operationId": "dashboard",
        "summary": "The Dashboard's figures",
        "description": "The Dashboard's figures for a period, in the time zone of whoever made the key (or the person's own): emails tracked and viewed, views, clicks, website visitors, where they came from, and the chart's series.\n\nKey area: The Event log (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "events"
        ],
        "x-tooli-area": "events",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "`today`, `7d` (unless said) or `30d`, in the caller's days.",
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "7d",
                "30d"
              ]
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "description": "`wide` (unless said): everything the caller may see; `mine`: a person's own records. A key has no records of its own and is always given `wide`.",
            "schema": {
              "type": "string",
              "enum": [
                "mine",
                "wide"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The Dashboard's figures",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "range": {
                      "type": "string",
                      "enum": [
                        "today",
                        "7d",
                        "30d"
                      ],
                      "description": "The period."
                    },
                    "from": {
                      "type": "string",
                      "description": "When the period began."
                    },
                    "to": {
                      "type": "string",
                      "description": "When it ends."
                    },
                    "timeZone": {
                      "type": "string",
                      "description": "The time zone its days were cut in."
                    },
                    "emails": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "number",
                          "description": "How many."
                        },
                        "previous": {
                          "type": "number",
                          "description": "How many in the period before."
                        },
                        "viewed": {
                          "type": "number",
                          "description": "Of those, the ones viewed."
                        }
                      },
                      "required": [
                        "value",
                        "previous",
                        "viewed"
                      ],
                      "description": "Emails tracked in the period."
                    },
                    "views": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "number",
                          "description": "How many."
                        },
                        "previous": {
                          "type": "number",
                          "description": "How many in the period before."
                        },
                        "automated": {
                          "type": "number",
                          "description": "Of those, the ones a machine most likely made."
                        }
                      },
                      "required": [
                        "value",
                        "previous",
                        "automated"
                      ],
                      "description": "Views of emails in the period, the senders' own left out."
                    },
                    "clicks": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "number",
                          "description": "How many."
                        },
                        "previous": {
                          "type": "number",
                          "description": "How many in the period before."
                        },
                        "automated": {
                          "type": "number",
                          "description": "Of those, the ones a machine most likely made."
                        }
                      },
                      "required": [
                        "value",
                        "previous",
                        "automated"
                      ],
                      "description": "Clicks on short links in the period."
                    },
                    "websites": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "value": {
                          "type": "number",
                          "description": "Different visitors among the visits a person most likely made."
                        },
                        "previous": {
                          "type": "number",
                          "description": "The same in the period before."
                        },
                        "visits": {
                          "type": "number",
                          "description": "Those visits."
                        }
                      },
                      "required": [
                        "value",
                        "previous",
                        "visits"
                      ],
                      "description": "Visitors to the organisation's websites in the period; null while it has none."
                    },
                    "places": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string",
                            "description": "The country, as a two-letter code."
                          },
                          "region": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The region."
                          },
                          "city": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The city."
                          },
                          "events": {
                            "type": "number",
                            "description": "Views and clicks from there."
                          }
                        },
                        "required": [
                          "country",
                          "region",
                          "city",
                          "events"
                        ]
                      },
                      "description": "Where views and clicks came from, most first."
                    },
                    "series": {
                      "type": "object",
                      "properties": {
                        "by": {
                          "type": "string",
                          "enum": [
                            "hour",
                            "day"
                          ],
                          "description": "By `hour` for today, by `day` otherwise."
                        },
                        "keys": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Each hour (`2026-11-19T14`) or day (`2026-11-19`)."
                        },
                        "views": {
                          "type": "array",
                          "items": {
                            "type": "number"
                          },
                          "description": "Views in each."
                        },
                        "clicks": {
                          "type": "array",
                          "items": {
                            "type": "number"
                          },
                          "description": "Clicks in each."
                        }
                      },
                      "required": [
                        "by",
                        "keys",
                        "views",
                        "clicks"
                      ],
                      "description": "Views and clicks over the period."
                    }
                  },
                  "required": [
                    "range",
                    "from",
                    "to",
                    "timeZone",
                    "emails",
                    "views",
                    "clicks",
                    "websites",
                    "places",
                    "series"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/network/ip/{ip}": {
      "get": {
        "operationId": "address",
        "summary": "An IP address",
        "description": "What is known of one IPv4 or IPv6 address in the organisation's events: its network, its place, the classes its requests were given, and those events, newest first. The same answer whether it was never seen or seen only in what the caller may not see.\n\nKey area: The Event log (read). For an app a person connected through MCP: anyone in the organisation.",
        "tags": [
          "events"
        ],
        "x-tooli-area": "events",
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "description": "An IPv4 or IPv6 address, as written anywhere (`2001:db8::1` is the same as its longer form).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many a page has.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The page after the one whose `next` this is.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An IP address",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ip": {
                      "type": "string",
                      "description": "The address, as Tooli writes it."
                    },
                    "family": {
                      "type": "number",
                      "enum": [
                        4,
                        6
                      ],
                      "description": "`4` or `6`."
                    },
                    "known": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "events": {
                          "type": "number",
                          "description": "Its events."
                        },
                        "firstAt": {
                          "type": "string",
                          "description": "The first."
                        },
                        "lastAt": {
                          "type": "string",
                          "description": "The latest."
                        },
                        "network": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The network the latest came from."
                        },
                        "asn": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "That network's number."
                        },
                        "place": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "The country, as a two-letter code."
                            },
                            "region": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "The region."
                            },
                            "city": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "The city."
                            }
                          },
                          "required": [
                            "country",
                            "region",
                            "city"
                          ],
                          "description": "Its place; null where a class hides it or it wasn't known."
                        },
                        "classes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "class": {
                                "type": "string",
                                "enum": [
                                  "direct",
                                  "gmail_proxy",
                                  "apple_privacy",
                                  "datacenter",
                                  "vpn",
                                  "bot",
                                  "scanner",
                                  "prefetch",
                                  "sender_preview"
                                ],
                                "description": "The class."
                              },
                              "events": {
                                "type": "number",
                                "description": "Its events of that class."
                              }
                            },
                            "required": [
                              "class",
                              "events"
                            ]
                          },
                          "description": "Every class its events were given, the most frequent first."
                        }
                      },
                      "required": [
                        "events",
                        "firstAt",
                        "lastAt",
                        "network",
                        "asn",
                        "place",
                        "classes"
                      ],
                      "description": "What is known of it; null when the caller has no events from it."
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      },
                      "description": "Its events, newest first."
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass it back as `cursor` for the page after; null on the last."
                    }
                  },
                  "required": [
                    "ip",
                    "family",
                    "known",
                    "rows",
                    "next"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks": {
      "get": {
        "operationId": "webhooks",
        "summary": "Webhooks",
        "description": "The organisation's webhooks: where each sends, which events, and how its deliveries are going.\n\nKey area: Webhooks (read). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "webhooks"
        ],
        "x-tooli-area": "webhooks",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      },
                      "description": "The page's records."
                    }
                  },
                  "required": [
                    "rows"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "webhookAdd",
        "summary": "Add a webhook",
        "description": "Adds a webhook. Its signing secret is in this answer once and never again: a retry with the same idempotency key is answered with `secret: null`.\n\nKey area: Webhooks (read and change). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "webhooks"
        ],
        "x-tooli-area": "webhooks",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Send an Idempotency-Key header (see Sending a change twice).",
            "schema": {
              "type": "string",
              "pattern": "^[\\w-]{16,64}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The `https` address to send each event to."
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "email.viewed",
                        "link.clicked",
                        "document.viewed",
                        "website.visited",
                        "reply.received"
                      ]
                    },
                    "description": "The events to send."
                  }
                },
                "required": [
                  "url",
                  "events"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Add a webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    "secret": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Its signing secret, shown this once; null to a retry with the same idempotency key."
                    }
                  },
                  "required": [
                    "webhook",
                    "secret"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks/{id}": {
      "put": {
        "operationId": "webhookChange",
        "summary": "Change a webhook's events",
        "description": "Sets which events a webhook sends.\n\nKey area: Webhooks (read and change). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "webhooks"
        ],
        "x-tooli-area": "webhooks",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "email.viewed",
                        "link.clicked",
                        "document.viewed",
                        "website.visited",
                        "reply.received"
                      ]
                    },
                    "description": "The events to send."
                  }
                },
                "required": [
                  "events"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Change a webhook's events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "webhookRemove",
        "summary": "Remove a webhook",
        "description": "Removes a webhook: nothing more is sent to it.\n\nKey area: Webhooks (read and change). For an app a person connected through MCP: admins and the owner.",
        "tags": [
          "webhooks"
        ],
        "x-tooli-area": "webhooks",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The record's id, as its list gives it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Remove a webhook"
          },
          "default": {
            "description": "A refusal or a failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}