{
  "openapi": "3.1.0",
  "info": {
    "title": "Tenanci API",
    "version": "2",
    "description": "Tenanci API v2: custom domains, branding, SEO, marketing and analytics for every customer of your app. Guide: https://docs.tenanci.com/en/api-overview/\n\nError message language: send `Accept-Language: en` (or `?lang=en`) to get `message` in English, `pt-BR` for Portuguese. Without one, the organization language applies, then pt-BR. `code` never changes."
  },
  "servers": [
    {
      "url": "https://api.tenanci.com/v2"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "Organization, subscription and usage for the current key.",
      "x-id": "account",
      "x-guide": "api-overview"
    },
    {
      "name": "Projects",
      "description": "The origin app and ownership verification.",
      "x-id": "projects",
      "x-guide": "projects"
    },
    {
      "name": "Domains",
      "description": "Your customers' domains: setup, DNS, status and settings.",
      "x-id": "domains",
      "x-guide": "domains"
    },
    {
      "name": "Routes, headers & scripts",
      "description": "Project rules (apply to every domain) and per-domain rules.",
      "x-id": "rules",
      "x-guide": "routes"
    },
    {
      "name": "Tenant context",
      "description": "Who the customer behind each domain is, sent signed to your origin.",
      "x-id": "tenant",
      "x-guide": "tenant-context"
    },
    {
      "name": "Access",
      "description": "Maintenance, password-protected preview and country/language redirects.",
      "x-id": "access",
      "x-guide": "access-control"
    },
    {
      "name": "Installable app",
      "description": "A PWA with the customer's brand on each domain.",
      "x-id": "pwa",
      "x-guide": "installable-app"
    },
    {
      "name": "TailorKit",
      "description": "Per-domain branding and visual tweaks: draft, publishing and versions.",
      "x-id": "tailorkit",
      "x-guide": "tailorkit"
    },
    {
      "name": "SEO",
      "description": "Titles, sitemap, robots, redirects, thumbnails and Search Console per domain.",
      "x-id": "seo",
      "x-guide": "seo"
    },
    {
      "name": "Marketing",
      "description": "Tags, cookie banner, short links, goals and server-side conversions.",
      "x-id": "marketing",
      "x-guide": "marketing-tags"
    },
    {
      "name": "A/B tests",
      "description": "Landing page tests on the same address.",
      "x-id": "experiments",
      "x-guide": "ab-testing"
    },
    {
      "name": "Analytics",
      "description": "Visits, pages, sources, campaigns and performance for each domain.",
      "x-id": "analytics",
      "x-guide": "analytics"
    },
    {
      "name": "Emails",
      "description": "Sender on the customer's domain and sending emails.",
      "x-id": "emails",
      "x-guide": "white-label-email"
    },
    {
      "name": "Customer portal",
      "description": "Access links for end customers to connect their domain and adjust branding.",
      "x-id": "portal",
      "x-guide": "customer-portal"
    },
    {
      "name": "Status & reports",
      "description": "Status page, incidents and end-customer report.",
      "x-id": "status",
      "x-guide": "status-page"
    },
    {
      "name": "AuthMesh & API Gateway",
      "description": "Third-party API calls without exposing the key (AuthMesh) and a gateway for your own APIs (Scale plan).",
      "x-id": "scale",
      "x-guide": "authmesh"
    },
    {
      "name": "AI",
      "description": "AI features: branding, translation and SEO.",
      "x-id": "ai",
      "x-guide": "ai-features"
    },
    {
      "name": "Plans",
      "description": "Plans, price preview and billing preferences.",
      "x-id": "billing",
      "x-guide": "plans-and-billing"
    },
    {
      "name": "Files",
      "description": "Image uploads (favicon, logo, thumbnails).",
      "x-id": "files"
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "get-me",
        "tags": [
          "Account"
        ],
        "summary": "Who am I: organization, subscription and usage",
        "description": "Handy to test a key and see how many domains the plan fits (`usage.capacity`).",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "principal": {
                    "kind": "api_key",
                    "orgId": "org_5t1v"
                  },
                  "organization": {
                    "id": "org_5t1v",
                    "name": "Agenda Fácil",
                    "profile": "saas_owner",
                    "referralSource": null,
                    "notifyDomainStatus": true,
                    "locale": "pt-BR",
                    "suspended": false,
                    "deletionScheduledFor": null
                  },
                  "organizations": [],
                  "subscription": {
                    "status": "active",
                    "plan": "growth",
                    "extraDomains": 0,
                    "extraPacks": 1,
                    "packSize": 100,
                    "packPriceCents": 7900,
                    "autoExtraPacks": true,
                    "currentPeriodEnd": "2026-11-01T00:00:00.000Z",
                    "cancelAt": null,
                    "legacyPrice": null
                  },
                  "active": true,
                  "entitlements": [
                    "analytics_advanced",
                    "tailorkit"
                  ],
                  "usage": {
                    "domains": 212,
                    "includedDomains": 200,
                    "capacity": 300
                  },
                  "comp": false,
                  "platformAdmin": false
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/me"
      }
    },
    "/projects": {
      "get": {
        "operationId": "get-projects",
        "tags": [
          "Projects"
        ],
        "summary": "List projects",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "prj_8f3k2m",
                      "name": "Barbearias",
                      "originUrl": "https://app.agendafacil.com",
                      "extraOrigins": [],
                      "status": "active",
                      "ownership": {
                        "verified": true,
                        "verifiedAt": "2026-10-01T14:03:11.000Z",
                        "record": {
                          "type": "TXT",
                          "name": "_tenanci-verify.agendafacil.com",
                          "value": "q3Zt9vXk2LwP8mR4sN7aB1cD5eF6gH0j"
                        }
                      },
                      "spa": {
                        "mode": "mask",
                        "initialRouteVar": false
                      },
                      "blockedPaths": [],
                      "tenantSecret": true,
                      "tailorkitViewerHost": null,
                      "platform": "bubble",
                      "legacyId": null,
                      "createdAt": "2026-10-01T13:58:40.000Z",
                      "updatedAt": "2026-10-01T14:03:11.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-projects",
        "tags": [
          "Projects"
        ],
        "summary": "Create a project",
        "description": "A project is your app (the origin). After creating it, publish the `ownership.record` TXT on the origin's DNS and call verify.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Project name."
                  },
                  "originUrl": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 2048,
                    "description": "App address (e.g. https://app.agendafacil.com)."
                  }
                },
                "required": [
                  "name",
                  "originUrl"
                ]
              },
              "example": {
                "name": "Barbearias",
                "originUrl": "https://app.agendafacil.com"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "prj_8f3k2m",
                  "name": "Barbearias",
                  "originUrl": "https://app.agendafacil.com",
                  "extraOrigins": [],
                  "status": "pending_verification",
                  "ownership": {
                    "verified": false,
                    "verifiedAt": null,
                    "record": {
                      "type": "TXT",
                      "name": "_tenanci-verify.agendafacil.com",
                      "value": "q3Zt9vXk2LwP8mR4sN7aB1cD5eF6gH0j"
                    }
                  },
                  "spa": {
                    "mode": "mask",
                    "initialRouteVar": false
                  },
                  "blockedPaths": [],
                  "tenantSecret": true,
                  "tailorkitViewerHost": null,
                  "platform": "bubble",
                  "legacyId": null,
                  "createdAt": "2026-10-01T13:58:40.000Z",
                  "updatedAt": "2026-10-01T14:03:11.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects",
        "x-scope": "domains:write"
      }
    },
    "/projects/{id}": {
      "get": {
        "operationId": "get-projects-id",
        "tags": [
          "Projects"
        ],
        "summary": "Get a project",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "prj_8f3k2m",
                  "name": "Barbearias",
                  "originUrl": "https://app.agendafacil.com",
                  "extraOrigins": [],
                  "status": "active",
                  "ownership": {
                    "verified": true,
                    "verifiedAt": "2026-10-01T14:03:11.000Z",
                    "record": {
                      "type": "TXT",
                      "name": "_tenanci-verify.agendafacil.com",
                      "value": "q3Zt9vXk2LwP8mR4sN7aB1cD5eF6gH0j"
                    }
                  },
                  "spa": {
                    "mode": "mask",
                    "initialRouteVar": false
                  },
                  "blockedPaths": [],
                  "tenantSecret": true,
                  "tailorkitViewerHost": null,
                  "platform": "bubble",
                  "legacyId": null,
                  "createdAt": "2026-10-01T13:58:40.000Z",
                  "updatedAt": "2026-10-01T14:03:11.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:id",
        "x-scope": "domains:read"
      },
      "patch": {
        "operationId": "patch-projects-id",
        "tags": [
          "Projects"
        ],
        "summary": "Update a project",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "originUrl": {
                    "description": "Changing the origin requires verifying again.",
                    "type": "string",
                    "maxLength": 2048
                  },
                  "extraOrigins": {
                    "description": "Other hosts the app uses (CDN, API) that the edge may serve under /__external__/.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "spaMode": {
                    "description": "SPA apps: mask (keeps the address) or redirect.",
                    "type": "string",
                    "enum": [
                      "mask",
                      "redirect"
                    ]
                  },
                  "spaInitialRouteVar": {
                    "description": "Sends the initial route to the app when a route is rewritten (Flutter and similar).",
                    "type": "boolean"
                  },
                  "blockedPaths": {
                    "description": "Paths blocked on every domain (404).",
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 250
                    }
                  }
                }
              },
              "example": {
                "blockedPaths": [
                  "/admin",
                  "/wp-login.php"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "prj_8f3k2m",
                  "name": "Barbearias",
                  "originUrl": "https://app.agendafacil.com",
                  "extraOrigins": [],
                  "status": "active",
                  "ownership": {
                    "verified": true,
                    "verifiedAt": "2026-10-01T14:03:11.000Z",
                    "record": {
                      "type": "TXT",
                      "name": "_tenanci-verify.agendafacil.com",
                      "value": "q3Zt9vXk2LwP8mR4sN7aB1cD5eF6gH0j"
                    }
                  },
                  "spa": {
                    "mode": "mask",
                    "initialRouteVar": false
                  },
                  "blockedPaths": [],
                  "tenantSecret": true,
                  "tailorkitViewerHost": null,
                  "platform": "bubble",
                  "legacyId": null,
                  "createdAt": "2026-10-01T13:58:40.000Z",
                  "updatedAt": "2026-10-01T14:03:11.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/projects/:id",
        "x-scope": "domains:write"
      },
      "delete": {
        "operationId": "delete-projects-id",
        "tags": [
          "Projects"
        ],
        "summary": "Delete a project",
        "description": "Also deletes the project's domains.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/projects/:id",
        "x-scope": "domains:write"
      }
    },
    "/projects/{id}/verify": {
      "post": {
        "operationId": "post-projects-id-verify",
        "tags": [
          "Projects"
        ],
        "summary": "Verify origin ownership",
        "description": "Checks the TXT record on the origin's DNS. Call again until `verified: true`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "verified": true,
                  "recordName": "_tenanci-verify.agendafacil.com",
                  "expected": "q3Zt9vXk2LwP8mR4sN7aB1cD5eF6gH0j",
                  "found": [
                    "q3Zt9vXk2LwP8mR4sN7aB1cD5eF6gH0j"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/verify",
        "x-scope": "domains:write"
      }
    },
    "/projects/{id}/platform/detect": {
      "post": {
        "operationId": "post-projects-id-platform-detect",
        "tags": [
          "Projects"
        ],
        "summary": "Detect the app's platform",
        "description": "Reads the origin and identifies Bubble, FlutterFlow, WeWeb, Softr, Lovable, Bolt…",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "platform": "bubble",
                  "why": "Script do Bubble na página inicial"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/platform/detect",
        "x-scope": "domains:write"
      }
    },
    "/projects/{id}/platform": {
      "put": {
        "operationId": "put-projects-id-platform",
        "tags": [
          "Projects"
        ],
        "summary": "Set the app's platform",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "platform": {
                    "type": "string",
                    "maxLength": 20,
                    "description": "bubble, flutterflow, weweb, softr, lovable, bolt, other…"
                  }
                },
                "required": [
                  "platform"
                ]
              },
              "example": {
                "platform": "flutterflow"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "platform": "flutterflow",
                  "why": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/projects/:id/platform",
        "x-scope": "domains:write"
      }
    },
    "/projects/{id}/rules/{kind}": {
      "get": {
        "operationId": "get-projects-id-rules-kind",
        "tags": [
          "Routes, headers & scripts"
        ],
        "summary": "List project rules",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "Rule type: routes, headers or injections",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "rte_2k9d7x",
                      "orgId": "org_5t1v",
                      "scopeType": "project",
                      "scopeId": "prj_8f3k2m",
                      "source": "/agendar",
                      "destination": "/booking",
                      "mode": "rewrite",
                      "enabled": true,
                      "position": 1,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:id/rules/:kind",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-projects-id-rules-kind",
        "tags": [
          "Routes, headers & scripts"
        ],
        "summary": "Create a project rule",
        "description": "The body depends on the type: routes `{source, destination, mode}`, headers `{name, value, direction}`, injections `{content, injectAt}`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "Rule type: routes, headers or injections",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "description": "Public path (e.g. /book). End with /* to match everything below it."
                      },
                      "destination": {
                        "type": "string",
                        "description": "Path on the origin (rewrite) or target address (redirect)."
                      },
                      "mode": {
                        "description": "rewrite (mask, default) or redirect.",
                        "type": "string",
                        "enum": [
                          "rewrite",
                          "redirect"
                        ]
                      }
                    },
                    "required": [
                      "source",
                      "destination"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "Header name."
                      },
                      "value": {
                        "type": "string",
                        "description": "Value."
                      },
                      "direction": {
                        "description": "request (to the origin) or response (to the visitor, default).",
                        "type": "string",
                        "enum": [
                          "request",
                          "response"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "value"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "content": {
                        "type": "string",
                        "description": "HTML/script to inject."
                      },
                      "injectAt": {
                        "description": "Where to inject: head or body.",
                        "type": "string",
                        "enum": [
                          "head",
                          "body"
                        ]
                      }
                    },
                    "required": [
                      "content"
                    ]
                  }
                ]
              },
              "example": {
                "source": "/agendar",
                "destination": "/booking",
                "mode": "rewrite"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "rte_2k9d7x",
                  "orgId": "org_5t1v",
                  "scopeType": "project",
                  "scopeId": "prj_8f3k2m",
                  "source": "/agendar",
                  "destination": "/booking",
                  "mode": "rewrite",
                  "enabled": true,
                  "position": 1,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/rules/:kind",
        "x-scope": "domains:write"
      }
    },
    "/projects/{id}/tenant-secret": {
      "post": {
        "operationId": "post-projects-id-tenant-secret",
        "tags": [
          "Tenant context"
        ],
        "summary": "Generate/rotate the signing secret",
        "description": "Secret used to sign the X-Tenanci-Tenant header. It's only shown in this response: store it in your app's backend.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "secret": "tsk_Q2xv…"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/tenant-secret",
        "x-scope": "domains:write"
      }
    },
    "/domains": {
      "get": {
        "operationId": "get-domains",
        "tags": [
          "Domains"
        ],
        "summary": "List domains",
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "description": "Only this project's domains.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items per page (default 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "dom_4h7n1q",
                      "projectId": "prj_8f3k2m",
                      "name": "Barbearia do Zé",
                      "hostname": "barbeariadoze.com.br",
                      "isApex": true,
                      "status": "pending_dns",
                      "statusReason": null,
                      "enabled": true,
                      "overrides": [],
                      "waf": {
                        "mode": "block",
                        "failMode": "open"
                      },
                      "analytics": {
                        "beacon": true,
                        "sampleRate": 1
                      },
                      "assets": {
                        "directFromOrigin": true,
                        "htmlCacheSeconds": 0
                      },
                      "blockedPaths": [],
                      "tenant": {
                        "id": "barbearia-123",
                        "data": {
                          "name": "Barbearia do Zé",
                          "plan": "pro"
                        },
                        "expose": false
                      },
                      "dns": {
                        "type": "A",
                        "name": "barbeariadoze.com.br",
                        "values": [
                          "109.224.228.49"
                        ]
                      },
                      "dnsCheckedAt": null,
                      "legacyId": null,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    }
                  ],
                  "nextCursor": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-domains",
        "tags": [
          "Domains"
        ],
        "summary": "Add a domain",
        "description": "Registers a customer's domain. The response's `dns` field holds the record the customer must create. Over the plan's included domains? With an API key, an extra-domain pack is bought automatically if the organization allows it; otherwise 409 `domain_limit_reached`.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Retrying with the same key returns the same response (no duplicates).",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string"
                  },
                  "hostname": {
                    "type": "string",
                    "maxLength": 253,
                    "description": "Domain (e.g. joesbarbershop.com or app.joesbarbershop.com)."
                  },
                  "name": {
                    "description": "A name you'll recognize (e.g. the customer's name).",
                    "type": "string",
                    "maxLength": 120
                  },
                  "faviconUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "overrides": {
                    "description": "Sections where the domain uses its own rules instead of the project's.",
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "routes",
                        "headers",
                        "injections"
                      ]
                    }
                  },
                  "acceptExtraCharge": {
                    "description": "Accept the extra-domain charge when over the plan.",
                    "type": "boolean"
                  },
                  "tenant": {
                    "description": "End customer of the domain (shortcut for PUT /domains/:id/tenant).",
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "data": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": [
                            "string",
                            "number",
                            "boolean",
                            "null"
                          ]
                        }
                      },
                      "expose": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "id"
                    ]
                  }
                },
                "required": [
                  "projectId",
                  "hostname"
                ]
              },
              "example": {
                "projectId": "prj_8f3k2m",
                "hostname": "barbeariadoze.com.br",
                "name": "Barbearia do Zé",
                "tenant": {
                  "id": "barbearia-123",
                  "data": {
                    "name": "Barbearia do Zé",
                    "plan": "pro"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "dom_4h7n1q",
                  "projectId": "prj_8f3k2m",
                  "name": "Barbearia do Zé",
                  "hostname": "barbeariadoze.com.br",
                  "isApex": true,
                  "status": "pending_dns",
                  "statusReason": null,
                  "enabled": true,
                  "overrides": [],
                  "waf": {
                    "mode": "block",
                    "failMode": "open"
                  },
                  "analytics": {
                    "beacon": true,
                    "sampleRate": 1
                  },
                  "assets": {
                    "directFromOrigin": true,
                    "htmlCacheSeconds": 0
                  },
                  "blockedPaths": [],
                  "tenant": {
                    "id": "barbearia-123",
                    "data": {
                      "name": "Barbearia do Zé",
                      "plan": "pro"
                    },
                    "expose": false
                  },
                  "dns": {
                    "type": "A",
                    "name": "barbeariadoze.com.br",
                    "values": [
                      "109.224.228.49"
                    ]
                  },
                  "dnsCheckedAt": null,
                  "legacyId": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains",
        "x-scope": "domains:write"
      }
    },
    "/domains-check": {
      "get": {
        "operationId": "get-domains-check",
        "tags": [
          "Domains"
        ],
        "summary": "Check a domain before adding it",
        "description": "Validates the format, tells whether it's an apex, which DNS record will be needed and whether it's available.",
        "parameters": [
          {
            "name": "hostname",
            "in": "query",
            "required": true,
            "description": "Domain to check.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "valid": true,
                  "hostname": "barbeariadoze.com.br",
                  "isApex": true,
                  "dns": {
                    "type": "A",
                    "name": "barbeariadoze.com.br",
                    "values": [
                      "109.224.228.49"
                    ]
                  },
                  "availability": "available"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains-check",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}": {
      "get": {
        "operationId": "get-domains-id",
        "tags": [
          "Domains"
        ],
        "summary": "Get a domain",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "dom_4h7n1q",
                  "projectId": "prj_8f3k2m",
                  "name": "Barbearia do Zé",
                  "hostname": "barbeariadoze.com.br",
                  "isApex": true,
                  "status": "pending_dns",
                  "statusReason": null,
                  "enabled": true,
                  "overrides": [],
                  "waf": {
                    "mode": "block",
                    "failMode": "open"
                  },
                  "analytics": {
                    "beacon": true,
                    "sampleRate": 1
                  },
                  "assets": {
                    "directFromOrigin": true,
                    "htmlCacheSeconds": 0
                  },
                  "blockedPaths": [],
                  "tenant": {
                    "id": "barbearia-123",
                    "data": {
                      "name": "Barbearia do Zé",
                      "plan": "pro"
                    },
                    "expose": false
                  },
                  "dns": {
                    "type": "A",
                    "name": "barbeariadoze.com.br",
                    "values": [
                      "109.224.228.49"
                    ]
                  },
                  "dnsCheckedAt": null,
                  "legacyId": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z",
                  "faviconUrl": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id",
        "x-scope": "domains:read"
      },
      "patch": {
        "operationId": "patch-domains-id",
        "tags": [
          "Domains"
        ],
        "summary": "Update a domain",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "overrides": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "routes",
                        "headers",
                        "injections"
                      ]
                    }
                  },
                  "wafMode": {
                    "description": "TenantGuard: off, monitor only or block.",
                    "type": "string",
                    "enum": [
                      "off",
                      "monitor",
                      "block"
                    ]
                  },
                  "wafFailMode": {
                    "description": "If TenantGuard is unavailable: let through (open) or block (closed).",
                    "type": "string",
                    "enum": [
                      "open",
                      "closed"
                    ]
                  },
                  "analyticsBeacon": {
                    "description": "Browser analytics script (Web Vitals, events).",
                    "type": "boolean"
                  },
                  "analyticsSampleRate": {
                    "description": "Fraction of visits recorded (1 = all).",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "assetsDirect": {
                    "description": "Static files straight from the origin (less traffic through the domain).",
                    "type": "boolean"
                  },
                  "blockedPaths": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 250
                    }
                  },
                  "htmlCacheSeconds": {
                    "description": "Short HTML cache in seconds (0 = off).",
                    "anyOf": [
                      {
                        "type": "number",
                        "const": 0
                      },
                      {
                        "type": "number",
                        "const": 60
                      },
                      {
                        "type": "number",
                        "const": 300
                      },
                      {
                        "type": "number",
                        "const": 3600
                      }
                    ]
                  },
                  "faviconUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "enabled": {
                    "description": "false takes the domain offline without deleting it.",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "htmlCacheSeconds": 60,
                "wafMode": "block"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "dom_4h7n1q",
                  "projectId": "prj_8f3k2m",
                  "name": "Barbearia do Zé",
                  "hostname": "barbeariadoze.com.br",
                  "isApex": true,
                  "status": "pending_dns",
                  "statusReason": null,
                  "enabled": true,
                  "overrides": [],
                  "waf": {
                    "mode": "block",
                    "failMode": "open"
                  },
                  "analytics": {
                    "beacon": true,
                    "sampleRate": 1
                  },
                  "assets": {
                    "directFromOrigin": true,
                    "htmlCacheSeconds": 0
                  },
                  "blockedPaths": [],
                  "tenant": {
                    "id": "barbearia-123",
                    "data": {
                      "name": "Barbearia do Zé",
                      "plan": "pro"
                    },
                    "expose": false
                  },
                  "dns": {
                    "type": "A",
                    "name": "barbeariadoze.com.br",
                    "values": [
                      "109.224.228.49"
                    ]
                  },
                  "dnsCheckedAt": null,
                  "legacyId": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/domains/:id",
        "x-scope": "domains:write"
      },
      "delete": {
        "operationId": "delete-domains-id",
        "tags": [
          "Domains"
        ],
        "summary": "Remove a domain",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/recheck": {
      "post": {
        "operationId": "post-domains-id-recheck",
        "tags": [
          "Domains"
        ],
        "summary": "Re-check DNS now",
        "description": "Tenanci checks on its own; use it when the customer just created the record.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "dom_4h7n1q",
                  "projectId": "prj_8f3k2m",
                  "name": "Barbearia do Zé",
                  "hostname": "barbeariadoze.com.br",
                  "isApex": true,
                  "status": "issuing_cert",
                  "statusReason": null,
                  "enabled": true,
                  "overrides": [],
                  "waf": {
                    "mode": "block",
                    "failMode": "open"
                  },
                  "analytics": {
                    "beacon": true,
                    "sampleRate": 1
                  },
                  "assets": {
                    "directFromOrigin": true,
                    "htmlCacheSeconds": 0
                  },
                  "blockedPaths": [],
                  "tenant": {
                    "id": "barbearia-123",
                    "data": {
                      "name": "Barbearia do Zé",
                      "plan": "pro"
                    },
                    "expose": false
                  },
                  "dns": {
                    "type": "A",
                    "name": "barbeariadoze.com.br",
                    "values": [
                      "109.224.228.49"
                    ]
                  },
                  "dnsCheckedAt": null,
                  "legacyId": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/recheck",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/events": {
      "get": {
        "operationId": "get-domains-id-events",
        "tags": [
          "Domains"
        ],
        "summary": "Domain timeline",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": 81,
                      "domainId": "dom_4h7n1q",
                      "fromStatus": "pending_dns",
                      "toStatus": "verifying",
                      "reason": "dns_ok",
                      "at": "2026-10-14T12:10:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/events",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/rules/{kind}": {
      "get": {
        "operationId": "get-domains-id-rules-kind",
        "tags": [
          "Routes, headers & scripts"
        ],
        "summary": "List domain rules",
        "description": "By default, the rules in effect on the domain (the project's, or its own if the domain overrides). `effective=false` lists only the domain's own.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "Rule type: routes, headers or injections",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "effective",
            "in": "query",
            "required": false,
            "description": "false: only the domain's own rules.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "rte_2k9d7x",
                      "orgId": "org_5t1v",
                      "scopeType": "project",
                      "scopeId": "prj_8f3k2m",
                      "source": "/agendar",
                      "destination": "/booking",
                      "mode": "rewrite",
                      "enabled": true,
                      "position": 1,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/rules/:kind",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-domains-id-rules-kind",
        "tags": [
          "Routes, headers & scripts"
        ],
        "summary": "Create a domain rule",
        "description": "The body depends on the type: routes `{source, destination, mode}`, headers `{name, value, direction}`, injections `{content, injectAt}`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "Rule type: routes, headers or injections",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "description": "Public path (e.g. /book). End with /* to match everything below it."
                      },
                      "destination": {
                        "type": "string",
                        "description": "Path on the origin (rewrite) or target address (redirect)."
                      },
                      "mode": {
                        "description": "rewrite (mask, default) or redirect.",
                        "type": "string",
                        "enum": [
                          "rewrite",
                          "redirect"
                        ]
                      }
                    },
                    "required": [
                      "source",
                      "destination"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "Header name."
                      },
                      "value": {
                        "type": "string",
                        "description": "Value."
                      },
                      "direction": {
                        "description": "request (to the origin) or response (to the visitor, default).",
                        "type": "string",
                        "enum": [
                          "request",
                          "response"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "value"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "content": {
                        "type": "string",
                        "description": "HTML/script to inject."
                      },
                      "injectAt": {
                        "description": "Where to inject: head or body.",
                        "type": "string",
                        "enum": [
                          "head",
                          "body"
                        ]
                      }
                    },
                    "required": [
                      "content"
                    ]
                  }
                ]
              },
              "example": {
                "name": "X-Frame-Options",
                "value": "SAMEORIGIN",
                "direction": "response"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "hdr_7m2p",
                  "orgId": "org_5t1v",
                  "scopeType": "domain",
                  "scopeId": "dom_4h7n1q",
                  "enabled": true,
                  "position": 1,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z",
                  "name": "X-Frame-Options",
                  "value": "SAMEORIGIN",
                  "direction": "response"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/rules/:kind",
        "x-scope": "domains:write"
      }
    },
    "/rules/{kind}/{ruleId}": {
      "patch": {
        "operationId": "patch-rules-kind-ruleid",
        "tags": [
          "Routes, headers & scripts"
        ],
        "summary": "Update a rule",
        "description": "The same fields as creation (all optional), plus `enabled` and `position`.",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "Rule type: routes, headers or injections",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "required": true,
            "description": "Rule id (rte_…, hdr_…, inj_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "additionalProperties": {}
              },
              "example": {
                "enabled": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "rte_2k9d7x",
                  "orgId": "org_5t1v",
                  "scopeType": "project",
                  "scopeId": "prj_8f3k2m",
                  "source": "/agendar",
                  "destination": "/booking",
                  "mode": "rewrite",
                  "enabled": false,
                  "position": 1,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/rules/:kind/:ruleId",
        "x-scope": "domains:write"
      },
      "delete": {
        "operationId": "delete-rules-kind-ruleid",
        "tags": [
          "Routes, headers & scripts"
        ],
        "summary": "Delete a rule",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "description": "Rule type: routes, headers or injections",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ruleId",
            "in": "path",
            "required": true,
            "description": "Rule id (rte_…, hdr_…, inj_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/rules/:kind/:ruleId",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/tenant": {
      "get": {
        "operationId": "get-domains-id-tenant",
        "tags": [
          "Tenant context"
        ],
        "summary": "Get the domain's tenant",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "barbearia-123",
                  "data": {
                    "name": "Barbearia do Zé",
                    "plan": "pro"
                  },
                  "expose": false,
                  "projectHasSecret": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/tenant",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-tenant",
        "tags": [
          "Tenant context"
        ],
        "summary": "Set the domain's tenant",
        "description": "The origin starts receiving `X-Tenanci-Tenant` (signed) on every request to this domain.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "description": "Customer id in your system (null removes it).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "data": {
                    "description": "Customer data sent to the origin (name, plan…).",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number",
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "expose": {
                    "description": "Also expose as window.TENANCI in the browser.",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "id": "barbearia-123",
                "data": {
                  "name": "Barbearia do Zé",
                  "plan": "pro"
                },
                "expose": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "barbearia-123",
                  "data": {
                    "name": "Barbearia do Zé",
                    "plan": "pro"
                  },
                  "expose": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/tenant",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/access": {
      "get": {
        "operationId": "get-domains-id-access",
        "tags": [
          "Access"
        ],
        "summary": "Get maintenance, password and redirects",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "maintenance": null,
                  "password": {
                    "enabled": true,
                    "message": "Prévia para o cliente",
                    "isSet": true
                  },
                  "redirects": []
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/access",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-access",
        "tags": [
          "Access"
        ],
        "summary": "Update maintenance, password and redirects",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "maintenance": {
                    "description": "Maintenance page (503).",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          },
                          "title": {
                            "type": "string",
                            "maxLength": 120
                          },
                          "message": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 1000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "until": {
                            "description": "Expected return (ISO 8601); becomes Retry-After.",
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 40
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "allowIps": {
                            "description": "IPs that keep seeing the site.",
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 50
                            }
                          },
                          "newPreviewLink": {
                            "description": "Generate a new preview link (the old one stops working).",
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "enabled"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "password": {
                    "description": "Password-protected preview.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          },
                          "password": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "message": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 500
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "enabled"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "redirects": {
                    "description": "Redirect by the visitor's country/language.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "maxLength": 300
                        },
                        "countries": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 2
                          }
                        },
                        "languages": {
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 12
                          }
                        },
                        "to": {
                          "type": "string",
                          "maxLength": 2048
                        },
                        "once": {
                          "description": "Only on the first visit.",
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "from",
                        "to"
                      ]
                    }
                  }
                }
              },
              "example": {
                "maintenance": {
                  "enabled": true,
                  "title": "Voltamos já",
                  "message": "Estamos atualizando o sistema.",
                  "until": "2026-10-15T03:00:00Z"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "maintenance": {
                    "enabled": true,
                    "title": "Voltamos já",
                    "message": "Estamos atualizando o sistema.",
                    "until": "2026-10-15T03:00:00Z",
                    "allowIps": [],
                    "previewUrl": "https://barbeariadoze.com.br/?tnc_preview=k3J9…"
                  },
                  "password": null,
                  "redirects": []
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/access",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/pwa": {
      "get": {
        "operationId": "get-domains-id-pwa",
        "tags": [
          "Installable app"
        ],
        "summary": "Get the installable app",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "enabled": true,
                  "settings": {
                    "name": "Barbearia do Zé",
                    "shortName": "Zé",
                    "description": "Agende seu corte",
                    "themeColor": "#1f2937",
                    "backgroundColor": "#ffffff",
                    "display": "standalone",
                    "startUrl": "/",
                    "lang": "pt-BR",
                    "icons": {
                      "icon192": "https://assets.tenanci.com/org_5t1v/i192.png",
                      "icon512": "https://assets.tenanci.com/org_5t1v/i512.png",
                      "maskable": "https://assets.tenanci.com/org_5t1v/mask.png",
                      "apple": "https://assets.tenanci.com/org_5t1v/apple.png"
                    },
                    "prompt": {
                      "enabled": true,
                      "text": "Instale o app da Barbearia do Zé",
                      "delaySeconds": 20
                    },
                    "offline": true,
                    "serviceWorker": true,
                    "screenshots": [
                      {
                        "url": "https://assets.tenanci.com/org_5t1v/tela-agenda.png",
                        "width": 1080,
                        "height": 1920,
                        "formFactor": "narrow",
                        "label": "Agenda do dia"
                      },
                      {
                        "url": "https://assets.tenanci.com/org_5t1v/tela-painel.png",
                        "width": 1920,
                        "height": 1080,
                        "formFactor": "wide",
                        "label": null
                      }
                    ]
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/pwa",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-pwa",
        "tags": [
          "Installable app"
        ],
        "summary": "Configure the installable app",
        "description": "Icons must be https URLs (upload them with POST /assets). In the dashboard, icons and iOS splash screens are generated from the logo. `screenshots` (optional, up to 8) goes into the manifest and gives Android and desktop Chrome/Edge a richer install dialog with the app's screens: `narrow` for phones (portrait) and `wide` for desktop; 320 to 3840 px per side, the longer side at most 2.3 times the shorter one.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "shortName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 30
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "themeColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      },
                      "backgroundColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      },
                      "display": {
                        "type": "string",
                        "enum": [
                          "standalone",
                          "fullscreen",
                          "minimal-ui"
                        ]
                      },
                      "startUrl": {
                        "type": "string",
                        "pattern": "^\\/(?!\\/)[^\\s]{0,299}$"
                      },
                      "lang": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 20
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "icons": {
                        "type": "object",
                        "properties": {
                          "icon192": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "icon512": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "maskable": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "apple": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          }
                        },
                        "required": [
                          "icon192",
                          "icon512",
                          "maskable",
                          "apple"
                        ],
                        "additionalProperties": false
                      },
                      "prompt": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          },
                          "text": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 200
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "delaySeconds": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 600
                          }
                        },
                        "required": [
                          "enabled",
                          "text",
                          "delaySeconds"
                        ],
                        "additionalProperties": false
                      },
                      "offline": {
                        "type": "boolean"
                      },
                      "serviceWorker": {
                        "type": "boolean"
                      },
                      "splash": {
                        "maxItems": 24,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "width": {
                              "type": "integer",
                              "minimum": 320,
                              "maximum": 4096
                            },
                            "height": {
                              "type": "integer",
                              "minimum": 320,
                              "maximum": 4096
                            },
                            "ratio": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 3
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "width",
                            "height",
                            "ratio",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "screenshots": {
                        "maxItems": 8,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            },
                            "width": {
                              "type": "integer",
                              "minimum": 320,
                              "maximum": 3840
                            },
                            "height": {
                              "type": "integer",
                              "minimum": 320,
                              "maximum": 3840
                            },
                            "formFactor": {
                              "type": "string",
                              "enum": [
                                "narrow",
                                "wide"
                              ]
                            },
                            "label": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 100
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "url",
                            "width",
                            "height",
                            "formFactor",
                            "label"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "name",
                      "shortName",
                      "description",
                      "themeColor",
                      "backgroundColor",
                      "display",
                      "startUrl",
                      "lang",
                      "icons",
                      "prompt",
                      "offline",
                      "serviceWorker"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "example": {
                "enabled": true,
                "settings": {
                  "name": "Barbearia do Zé",
                  "shortName": "Zé",
                  "description": "Agende seu corte",
                  "themeColor": "#1f2937",
                  "backgroundColor": "#ffffff",
                  "display": "standalone",
                  "startUrl": "/",
                  "lang": "pt-BR",
                  "icons": {
                    "icon192": "https://assets.tenanci.com/org_5t1v/i192.png",
                    "icon512": "https://assets.tenanci.com/org_5t1v/i512.png",
                    "maskable": "https://assets.tenanci.com/org_5t1v/mask.png",
                    "apple": "https://assets.tenanci.com/org_5t1v/apple.png"
                  },
                  "prompt": {
                    "enabled": true,
                    "text": "Instale o app da Barbearia do Zé",
                    "delaySeconds": 20
                  },
                  "offline": true,
                  "serviceWorker": true,
                  "screenshots": [
                    {
                      "url": "https://assets.tenanci.com/org_5t1v/tela-agenda.png",
                      "width": 1080,
                      "height": 1920,
                      "formFactor": "narrow",
                      "label": "Agenda do dia"
                    },
                    {
                      "url": "https://assets.tenanci.com/org_5t1v/tela-painel.png",
                      "width": 1920,
                      "height": 1080,
                      "formFactor": "wide",
                      "label": null
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "enabled": true,
                  "settings": {
                    "name": "Barbearia do Zé",
                    "shortName": "Zé",
                    "description": "Agende seu corte",
                    "themeColor": "#1f2937",
                    "backgroundColor": "#ffffff",
                    "display": "standalone",
                    "startUrl": "/",
                    "lang": "pt-BR",
                    "icons": {
                      "icon192": "https://assets.tenanci.com/org_5t1v/i192.png",
                      "icon512": "https://assets.tenanci.com/org_5t1v/i512.png",
                      "maskable": "https://assets.tenanci.com/org_5t1v/mask.png",
                      "apple": "https://assets.tenanci.com/org_5t1v/apple.png"
                    },
                    "prompt": {
                      "enabled": true,
                      "text": "Instale o app da Barbearia do Zé",
                      "delaySeconds": 20
                    },
                    "offline": true,
                    "serviceWorker": true,
                    "screenshots": [
                      {
                        "url": "https://assets.tenanci.com/org_5t1v/tela-agenda.png",
                        "width": 1080,
                        "height": 1920,
                        "formFactor": "narrow",
                        "label": "Agenda do dia"
                      },
                      {
                        "url": "https://assets.tenanci.com/org_5t1v/tela-painel.png",
                        "width": 1920,
                        "height": 1080,
                        "formFactor": "wide",
                        "label": null
                      }
                    ]
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/pwa",
        "x-scope": "domains:write"
      }
    },
    "/assets": {
      "post": {
        "operationId": "post-assets",
        "tags": [
          "Files"
        ],
        "summary": "Upload an image",
        "description": "`file` field (PNG, JPG, WebP, SVG or ICO). Returns the public URL to use for favicon, logo and thumbnails.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "ast_3n8q",
                  "url": "https://assets.tenanci.com/org_5t1v/3n8q.png",
                  "contentType": "image/png",
                  "size": 18342
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/assets",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/tailorkit": {
      "get": {
        "operationId": "get-domains-id-tailorkit",
        "tags": [
          "TailorKit"
        ],
        "summary": "Get draft, published version and history",
        "description": "Returns the current draft, the live document, the latest versions (up to 50) and the scheduled publish (`scheduled`, null if none). Rules saved in the old format (v1) come already converted to the v2 document.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "draft": {
                    "version": 3,
                    "document": {
                      "version": 2,
                      "theme": {
                        "colors": {
                          "primary": "#b45309",
                          "secondary": "#1f2937",
                          "accent": null,
                          "background": "#ffffff",
                          "text": "#111827"
                        },
                        "fonts": {
                          "heading": "Playfair Display",
                          "body": "Inter"
                        },
                        "radius": 8,
                        "logo": {
                          "url": "https://assets.tenanci.com/org_5t1v/3n8q.png",
                          "maxHeight": 48
                        },
                        "cssVars": {
                          "--brand": "#b45309"
                        },
                        "logoTargets": []
                      },
                      "globalCss": "",
                      "replacements": [
                        {
                          "find": "Agenda Fácil",
                          "replace": "Barbearia do Zé",
                          "caseSensitive": false
                        }
                      ],
                      "pages": {
                        "/": {
                          "css": "",
                          "rules": [
                            {
                              "id": "r_titulo",
                              "target": {
                                "tag": "h1",
                                "id": null,
                                "testId": null,
                                "aria": null,
                                "text": "Agende seu horário",
                                "css": "main > h1:nth-of-type(1)",
                                "attrs": {},
                                "nth": 0
                              },
                              "action": {
                                "type": "setText",
                                "value": "Agende seu corte na Barbearia do Zé"
                              },
                              "devices": [],
                              "enabled": true,
                              "note": null
                            }
                          ]
                        }
                      }
                    },
                    "updatedAt": "2026-10-15T18:20:00.000Z"
                  },
                  "published": {
                    "version": 2,
                    "document": {
                      "version": 2,
                      "theme": {
                        "colors": {
                          "primary": "#b45309",
                          "secondary": "#1f2937",
                          "accent": null,
                          "background": "#ffffff",
                          "text": "#111827"
                        },
                        "fonts": {
                          "heading": "Playfair Display",
                          "body": "Inter"
                        },
                        "radius": 8,
                        "logo": {
                          "url": "https://assets.tenanci.com/org_5t1v/3n8q.png",
                          "maxHeight": 48
                        },
                        "cssVars": {
                          "--brand": "#b45309"
                        },
                        "logoTargets": []
                      },
                      "globalCss": "",
                      "replacements": [],
                      "pages": {
                        "/": {
                          "css": "",
                          "rules": [
                            {
                              "id": "r_titulo",
                              "target": {
                                "tag": "h1",
                                "id": null,
                                "testId": null,
                                "aria": null,
                                "text": "Agende seu horário",
                                "css": "main > h1:nth-of-type(1)",
                                "attrs": {},
                                "nth": 0
                              },
                              "action": {
                                "type": "setText",
                                "value": "Agende seu corte na Barbearia do Zé"
                              },
                              "devices": [],
                              "enabled": true,
                              "note": null
                            }
                          ]
                        }
                      }
                    },
                    "publishedAt": "2026-10-14T16:00:00.000Z"
                  },
                  "history": [
                    {
                      "version": 2,
                      "status": "published",
                      "publishedAt": "2026-10-14T16:00:00.000Z",
                      "createdBy": "usr_01J9Z8Q3K4M5N6P7Q8R9S0T1V2"
                    },
                    {
                      "version": 1,
                      "status": "archived",
                      "publishedAt": "2026-10-14T12:30:00.000Z",
                      "createdBy": "usr_01J9Z8Q3K4M5N6P7Q8R9S0T1V2"
                    }
                  ],
                  "scheduled": {
                    "at": "2026-10-20T12:00:00.000Z",
                    "version": 3,
                    "by": "usr_01J9Z8Q3K4M5N6P7Q8R9S0T1V2"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/tailorkit",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/tailorkit/draft": {
      "put": {
        "operationId": "put-domains-id-tailorkit-draft",
        "tags": [
          "TailorKit"
        ],
        "summary": "Save the draft",
        "description": "Replaces the draft document (creates the draft if there is none). Nothing goes live until you publish. 1 MB limit (400 `rules_too_large`); an invalid document returns 400 `invalid_rules` with the problems in `details`. Older integrations may send `{ rules: … }` in the v1 format, which is converted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "document": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "number",
                        "const": 2
                      },
                      "breakpoints": {
                        "type": "object",
                        "properties": {
                          "tablet": {
                            "type": "integer",
                            "minimum": 320,
                            "maximum": 2560
                          },
                          "mobile": {
                            "type": "integer",
                            "minimum": 240,
                            "maximum": 1600
                          }
                        },
                        "required": [
                          "tablet",
                          "mobile"
                        ],
                        "additionalProperties": false
                      },
                      "theme": {
                        "type": "object",
                        "properties": {
                          "colors": {
                            "type": "object",
                            "properties": {
                              "primary": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "secondary": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "accent": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "background": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "text": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "primary",
                              "secondary",
                              "accent",
                              "background",
                              "text"
                            ],
                            "additionalProperties": false
                          },
                          "fonts": {
                            "type": "object",
                            "properties": {
                              "heading": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 80
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "body": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 80
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "heading",
                              "body"
                            ],
                            "additionalProperties": false
                          },
                          "radius": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 64
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "logo": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string",
                                    "maxLength": 2048,
                                    "format": "uri"
                                  },
                                  "maxHeight": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 400
                                  }
                                },
                                "required": [
                                  "url",
                                  "maxHeight"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cssVars": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "pattern": "^--[A-Za-z0-9-_]+$"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "logoTargets": {
                            "maxItems": 10,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "tag": {
                                  "type": "string",
                                  "maxLength": 40
                                },
                                "id": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 300
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "testId": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 300
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "aria": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 300
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "text": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 200
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "css": {
                                  "type": "string",
                                  "maxLength": 2000
                                },
                                "attrs": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string",
                                    "maxLength": 40
                                  },
                                  "additionalProperties": {
                                    "type": "string",
                                    "maxLength": 500
                                  }
                                },
                                "nth": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "classes": {
                                  "maxItems": 6,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "maxLength": 100
                                  }
                                }
                              },
                              "required": [
                                "tag",
                                "id",
                                "testId",
                                "aria",
                                "text",
                                "css",
                                "attrs",
                                "nth"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "colors",
                          "fonts",
                          "radius",
                          "logo",
                          "cssVars",
                          "logoTargets"
                        ],
                        "additionalProperties": false
                      },
                      "globalCss": {
                        "type": "string",
                        "maxLength": 50000
                      },
                      "replacements": {
                        "maxItems": 200,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "find": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            },
                            "replace": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "caseSensitive": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "find",
                            "replace",
                            "caseSensitive"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "pages": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "maxLength": 2048,
                          "format": "starts_with",
                          "pattern": "^\\/.*"
                        },
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "css": {
                              "type": "string",
                              "maxLength": 50000
                            },
                            "rules": {
                              "maxItems": 1000,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 40
                                  },
                                  "target": {
                                    "type": "object",
                                    "properties": {
                                      "tag": {
                                        "type": "string",
                                        "maxLength": 40
                                      },
                                      "id": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 300
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "testId": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 300
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "aria": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 300
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "text": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "css": {
                                        "type": "string",
                                        "maxLength": 2000
                                      },
                                      "attrs": {
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string",
                                          "maxLength": 40
                                        },
                                        "additionalProperties": {
                                          "type": "string",
                                          "maxLength": 500
                                        }
                                      },
                                      "nth": {
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "classes": {
                                        "maxItems": 6,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "maxLength": 100
                                        }
                                      }
                                    },
                                    "required": [
                                      "tag",
                                      "id",
                                      "testId",
                                      "aria",
                                      "text",
                                      "css",
                                      "attrs",
                                      "nth"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "action": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "setText"
                                          },
                                          "value": {
                                            "type": "string",
                                            "maxLength": 20000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "setImage"
                                          },
                                          "src": {
                                            "type": "string",
                                            "maxLength": 2048,
                                            "format": "uri"
                                          },
                                          "alt": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "maxLength": 420
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "src",
                                          "alt"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "setStyle"
                                          },
                                          "styles": {
                                            "type": "object",
                                            "propertyNames": {
                                              "type": "string",
                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                            },
                                            "additionalProperties": {
                                              "type": "string",
                                              "maxLength": 1000
                                            }
                                          },
                                          "hover": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string",
                                                  "pattern": "^-?[a-z][a-z0-9-]*$"
                                                },
                                                "additionalProperties": {
                                                  "type": "string",
                                                  "maxLength": 1000
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "tablet": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string",
                                                  "pattern": "^-?[a-z][a-z0-9-]*$"
                                                },
                                                "additionalProperties": {
                                                  "type": "string",
                                                  "maxLength": 1000
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "mobile": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string",
                                                  "pattern": "^-?[a-z][a-z0-9-]*$"
                                                },
                                                "additionalProperties": {
                                                  "type": "string",
                                                  "maxLength": 1000
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "focus": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string",
                                                  "pattern": "^-?[a-z][a-z0-9-]*$"
                                                },
                                                "additionalProperties": {
                                                  "type": "string",
                                                  "maxLength": 1000
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "active": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string",
                                                  "pattern": "^-?[a-z][a-z0-9-]*$"
                                                },
                                                "additionalProperties": {
                                                  "type": "string",
                                                  "maxLength": 1000
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "disabled": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string",
                                                  "pattern": "^-?[a-z][a-z0-9-]*$"
                                                },
                                                "additionalProperties": {
                                                  "type": "string",
                                                  "maxLength": 1000
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "placeholder": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string",
                                                  "pattern": "^-?[a-z][a-z0-9-]*$"
                                                },
                                                "additionalProperties": {
                                                  "type": "string",
                                                  "maxLength": 1000
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "css": {
                                            "type": "string",
                                            "maxLength": 5000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "styles",
                                          "hover",
                                          "tablet",
                                          "mobile"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "hide"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "setLink"
                                          },
                                          "href": {
                                            "type": "string",
                                            "maxLength": 2048
                                          },
                                          "newTab": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "href",
                                          "newTab"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "setAttr"
                                          },
                                          "name": {
                                            "type": "string",
                                            "enum": [
                                              "alt",
                                              "title",
                                              "placeholder",
                                              "aria-label",
                                              "value"
                                            ]
                                          },
                                          "value": {
                                            "type": "string",
                                            "maxLength": 1000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "name",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "insertBlock"
                                          },
                                          "position": {
                                            "type": "string",
                                            "enum": [
                                              "before",
                                              "after",
                                              "prepend",
                                              "append"
                                            ]
                                          },
                                          "html": {
                                            "type": "string",
                                            "maxLength": 50000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "position",
                                          "html"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  "devices": {
                                    "maxItems": 3,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "enum": [
                                        "desktop",
                                        "tablet",
                                        "mobile"
                                      ]
                                    }
                                  },
                                  "match": {
                                    "type": "string",
                                    "enum": [
                                      "one",
                                      "all"
                                    ]
                                  },
                                  "when": {
                                    "type": "object",
                                    "properties": {
                                      "query": {
                                        "maxItems": 5,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "name": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 100
                                            },
                                            "value": {
                                              "anyOf": [
                                                {
                                                  "type": "string",
                                                  "maxLength": 500
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            }
                                          },
                                          "required": [
                                            "name",
                                            "value"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "hash": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 500
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "query",
                                      "hash"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "enabled": {
                                    "type": "boolean"
                                  },
                                  "note": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 300
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "target",
                                  "action",
                                  "devices",
                                  "enabled",
                                  "note"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "css",
                            "rules"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "experiments": {
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "running",
                                "paused",
                                "ended"
                              ]
                            },
                            "goal": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 60
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "controlWeight": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "variants": {
                              "minItems": 1,
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "enum": [
                                      "b",
                                      "c",
                                      "d"
                                    ]
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 60
                                  },
                                  "weight": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 100
                                  },
                                  "pages": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "format": "starts_with",
                                      "pattern": "^\\/.*"
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "css": {
                                          "type": "string",
                                          "maxLength": 50000
                                        },
                                        "rules": {
                                          "maxItems": 1000,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 40
                                              },
                                              "target": {
                                                "type": "object",
                                                "properties": {
                                                  "tag": {
                                                    "type": "string",
                                                    "maxLength": 40
                                                  },
                                                  "id": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 300
                                                      },
                                                      {
                                                        "type": "null"
                                                      }
                                                    ]
                                                  },
                                                  "testId": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 300
                                                      },
                                                      {
                                                        "type": "null"
                                                      }
                                                    ]
                                                  },
                                                  "aria": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 300
                                                      },
                                                      {
                                                        "type": "null"
                                                      }
                                                    ]
                                                  },
                                                  "text": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 200
                                                      },
                                                      {
                                                        "type": "null"
                                                      }
                                                    ]
                                                  },
                                                  "css": {
                                                    "type": "string",
                                                    "maxLength": 2000
                                                  },
                                                  "attrs": {
                                                    "type": "object",
                                                    "propertyNames": {
                                                      "type": "string",
                                                      "maxLength": 40
                                                    },
                                                    "additionalProperties": {
                                                      "type": "string",
                                                      "maxLength": 500
                                                    }
                                                  },
                                                  "nth": {
                                                    "anyOf": [
                                                      {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      {
                                                        "type": "null"
                                                      }
                                                    ]
                                                  },
                                                  "classes": {
                                                    "maxItems": 6,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "maxLength": 100
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "tag",
                                                  "id",
                                                  "testId",
                                                  "aria",
                                                  "text",
                                                  "css",
                                                  "attrs",
                                                  "nth"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "action": {
                                                "oneOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "setText"
                                                      },
                                                      "value": {
                                                        "type": "string",
                                                        "maxLength": 20000
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "value"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "setImage"
                                                      },
                                                      "src": {
                                                        "type": "string",
                                                        "maxLength": 2048,
                                                        "format": "uri"
                                                      },
                                                      "alt": {
                                                        "anyOf": [
                                                          {
                                                            "type": "string",
                                                            "maxLength": 420
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "src",
                                                      "alt"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "setStyle"
                                                      },
                                                      "styles": {
                                                        "type": "object",
                                                        "propertyNames": {
                                                          "type": "string",
                                                          "pattern": "^-?[a-z][a-z0-9-]*$"
                                                        },
                                                        "additionalProperties": {
                                                          "type": "string",
                                                          "maxLength": 1000
                                                        }
                                                      },
                                                      "hover": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string",
                                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                                            },
                                                            "additionalProperties": {
                                                              "type": "string",
                                                              "maxLength": 1000
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "tablet": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string",
                                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                                            },
                                                            "additionalProperties": {
                                                              "type": "string",
                                                              "maxLength": 1000
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "mobile": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string",
                                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                                            },
                                                            "additionalProperties": {
                                                              "type": "string",
                                                              "maxLength": 1000
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "focus": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string",
                                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                                            },
                                                            "additionalProperties": {
                                                              "type": "string",
                                                              "maxLength": 1000
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "active": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string",
                                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                                            },
                                                            "additionalProperties": {
                                                              "type": "string",
                                                              "maxLength": 1000
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "disabled": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string",
                                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                                            },
                                                            "additionalProperties": {
                                                              "type": "string",
                                                              "maxLength": 1000
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "placeholder": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string",
                                                              "pattern": "^-?[a-z][a-z0-9-]*$"
                                                            },
                                                            "additionalProperties": {
                                                              "type": "string",
                                                              "maxLength": 1000
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "css": {
                                                        "type": "string",
                                                        "maxLength": 5000
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "styles",
                                                      "hover",
                                                      "tablet",
                                                      "mobile"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "hide"
                                                      }
                                                    },
                                                    "required": [
                                                      "type"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "setLink"
                                                      },
                                                      "href": {
                                                        "type": "string",
                                                        "maxLength": 2048
                                                      },
                                                      "newTab": {
                                                        "type": "boolean"
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "href",
                                                      "newTab"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "setAttr"
                                                      },
                                                      "name": {
                                                        "type": "string",
                                                        "enum": [
                                                          "alt",
                                                          "title",
                                                          "placeholder",
                                                          "aria-label",
                                                          "value"
                                                        ]
                                                      },
                                                      "value": {
                                                        "type": "string",
                                                        "maxLength": 1000
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "name",
                                                      "value"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "insertBlock"
                                                      },
                                                      "position": {
                                                        "type": "string",
                                                        "enum": [
                                                          "before",
                                                          "after",
                                                          "prepend",
                                                          "append"
                                                        ]
                                                      },
                                                      "html": {
                                                        "type": "string",
                                                        "maxLength": 50000
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "position",
                                                      "html"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                ]
                                              },
                                              "devices": {
                                                "maxItems": 3,
                                                "type": "array",
                                                "items": {
                                                  "type": "string",
                                                  "enum": [
                                                    "desktop",
                                                    "tablet",
                                                    "mobile"
                                                  ]
                                                }
                                              },
                                              "match": {
                                                "type": "string",
                                                "enum": [
                                                  "one",
                                                  "all"
                                                ]
                                              },
                                              "when": {
                                                "type": "object",
                                                "properties": {
                                                  "query": {
                                                    "maxItems": 5,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "properties": {
                                                        "name": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 100
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "string",
                                                              "maxLength": 500
                                                            },
                                                            {
                                                              "type": "null"
                                                            }
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "name",
                                                        "value"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "hash": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 500
                                                      },
                                                      {
                                                        "type": "null"
                                                      }
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "query",
                                                  "hash"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "enabled": {
                                                "type": "boolean"
                                              },
                                              "note": {
                                                "anyOf": [
                                                  {
                                                    "type": "string",
                                                    "maxLength": 300
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "target",
                                              "action",
                                              "devices",
                                              "enabled",
                                              "note"
                                            ],
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": [
                                        "css",
                                        "rules"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "brand": {
                                    "type": "object",
                                    "properties": {
                                      "primary": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 64
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "secondary": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 64
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "background": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 64
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "text": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 64
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "logo": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 2048,
                                            "format": "uri"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "primary",
                                      "secondary",
                                      "background",
                                      "text",
                                      "logo"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "key",
                                  "name",
                                  "weight",
                                  "pages"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "winner": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "a",
                                    "b",
                                    "c",
                                    "d"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "startedAt": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "status",
                            "goal",
                            "controlWeight",
                            "variants",
                            "winner",
                            "startedAt"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "translation": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "lang": {
                                "type": "string",
                                "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
                              },
                              "strings": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                },
                                "additionalProperties": {
                                  "type": "string",
                                  "maxLength": 2000
                                }
                              }
                            },
                            "required": [
                              "lang",
                              "strings"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "version",
                      "theme",
                      "globalCss",
                      "replacements",
                      "pages"
                    ],
                    "additionalProperties": false,
                    "description": "TailorKit 2.0 document: theme, global CSS, text replacements, per-page rules, A/B tests and translation."
                  }
                },
                "required": [
                  "document"
                ]
              },
              "example": {
                "document": {
                  "version": 2,
                  "theme": {
                    "colors": {
                      "primary": "#b45309",
                      "secondary": "#1f2937",
                      "accent": null,
                      "background": "#ffffff",
                      "text": "#111827"
                    },
                    "fonts": {
                      "heading": "Playfair Display",
                      "body": "Inter"
                    },
                    "radius": 8,
                    "logo": {
                      "url": "https://assets.tenanci.com/org_5t1v/3n8q.png",
                      "maxHeight": 48
                    },
                    "cssVars": {
                      "--brand": "#b45309"
                    },
                    "logoTargets": []
                  },
                  "globalCss": "",
                  "replacements": [
                    {
                      "find": "Agenda Fácil",
                      "replace": "Barbearia do Zé",
                      "caseSensitive": false
                    }
                  ],
                  "pages": {
                    "/": {
                      "css": "",
                      "rules": [
                        {
                          "id": "r_titulo",
                          "target": {
                            "tag": "h1",
                            "id": null,
                            "testId": null,
                            "aria": null,
                            "text": "Agende seu horário",
                            "css": "main > h1:nth-of-type(1)",
                            "attrs": {},
                            "nth": 0
                          },
                          "action": {
                            "type": "setText",
                            "value": "Agende seu corte na Barbearia do Zé"
                          },
                          "devices": [],
                          "enabled": true,
                          "note": null
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft version",
            "content": {
              "application/json": {
                "example": {
                  "version": 3
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/tailorkit/draft",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/tailorkit/schedule": {
      "post": {
        "operationId": "post-domains-id-tailorkit-schedule",
        "tags": [
          "TailorKit"
        ],
        "summary": "Schedule the draft's publish",
        "description": "Publishes the draft at the given time (from 1 minute up to 365 days ahead; otherwise 400 `invalid_schedule`). Scheduling again replaces the previous schedule. No draft: 400 `no_draft`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                    "description": "Publish date and time (ISO 8601, with offset)."
                  }
                },
                "required": [
                  "at"
                ]
              },
              "example": {
                "at": "2026-10-20T09:00:00-03:00"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "version": 3,
                  "at": "2026-10-20T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/tailorkit/schedule",
        "x-scope": "domains:write",
        "x-plan": "growth"
      },
      "delete": {
        "operationId": "delete-domains-id-tailorkit-schedule",
        "tags": [
          "TailorKit"
        ],
        "summary": "Cancel the scheduled publish",
        "description": "`canceled: false` when there was no pending schedule. The draft stays saved.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "canceled": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/tailorkit/schedule",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/tailorkit/publish": {
      "post": {
        "operationId": "post-domains-id-tailorkit-publish",
        "tags": [
          "TailorKit"
        ],
        "summary": "Publish the draft now",
        "description": "The draft becomes the live version and the previous one goes to history. No draft: 400 `no_draft`. A pending schedule isn't canceled (if there's no draft at that time, it does nothing).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "version": 3
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/tailorkit/publish",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/tailorkit/rollback/{version}": {
      "post": {
        "operationId": "post-domains-id-tailorkit-rollback-version",
        "tags": [
          "TailorKit"
        ],
        "summary": "Roll back to a previous version",
        "description": "Copies the chosen version into a new version and publishes it. The current draft is discarded.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "description": "Version number (see `history`)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "version": 4
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/tailorkit/rollback/:version",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/ai/status": {
      "get": {
        "operationId": "get-ai-status",
        "tags": [
          "AI"
        ],
        "summary": "AI availability and usage",
        "description": "`used` counts the organization's AI requests in the last 24 h; `limit` null = no limit. `languages` lists the languages accepted for translation.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "available": true,
                  "used": 3,
                  "limit": 50,
                  "languages": {
                    "en": "inglês",
                    "es": "espanhol",
                    "pt-BR": "português do Brasil",
                    "pt-PT": "português de Portugal",
                    "fr": "francês",
                    "de": "alemão",
                    "it": "italiano",
                    "nl": "holandês",
                    "pl": "polonês",
                    "tr": "turco",
                    "ru": "russo",
                    "uk": "ucraniano",
                    "ar": "árabe",
                    "he": "hebraico",
                    "hi": "hindi",
                    "ja": "japonês",
                    "ko": "coreano",
                    "zh-CN": "chinês simplificado",
                    "zh-TW": "chinês tradicional",
                    "id": "indonésio",
                    "vi": "vietnamita",
                    "th": "tailandês"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/ai/status",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/tailorkit/ai/brand": {
      "post": {
        "operationId": "post-domains-id-tailorkit-ai-brand",
        "tags": [
          "AI"
        ],
        "summary": "Import a website's brand with AI",
        "description": "Reads the website (HTML and stylesheets) and suggests colors, fonts and logo for the theme. The logo is copied to the organization's files when possible. Site returning an error, not HTML, or without a detectable brand: 400 `url_unreachable`, `url_not_html` or `brand_not_found`. Uses AI: without AI configured on the environment it returns 501 `ai_unavailable`; over the organization's daily limit, 429 `ai_limit` (see GET /ai/status). Nothing is saved: apply the result to the draft and publish.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 2048,
                    "description": "Address of the website with the brand (e.g. the customer's company site)."
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://barbeariadoze.com.br"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "source": "https://barbeariadoze.com.br/",
                  "theme": {
                    "colors": {
                      "primary": "#b45309",
                      "secondary": "#1f2937",
                      "accent": null,
                      "background": "#ffffff",
                      "text": "#111827"
                    },
                    "fonts": {
                      "heading": "Playfair Display",
                      "body": "Inter"
                    },
                    "logo": "https://assets.tenanci.com/org_5t1v/7k2m.png"
                  },
                  "notes": "O âmbar dos botões é a cor principal da marca e o grafite do cabeçalho, a secundária. Os títulos usam Playfair Display, do Google Fonts.",
                  "found": {
                    "colors": [
                      "#b45309",
                      "#1f2937",
                      "#ffffff",
                      "#111827",
                      "#f3f4f6"
                    ],
                    "fonts": [
                      "Playfair Display",
                      "Inter"
                    ],
                    "logos": [
                      "https://barbeariadoze.com.br/img/logo.png",
                      "https://barbeariadoze.com.br/apple-touch-icon.png"
                    ]
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/tailorkit/ai/brand",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/tailorkit/ai/translate": {
      "post": {
        "operationId": "post-domains-id-tailorkit-ai-translate",
        "tags": [
          "AI"
        ],
        "summary": "Translate app texts with AI",
        "description": "Returns original → translation, ready for the document's `translation.strings`. Repeated, empty, letterless or over-500-character texts are ignored. Language not listed by GET /ai/status: 400 `invalid_lang`. Uses AI: without AI configured on the environment it returns 501 `ai_unavailable`; over the organization's daily limit, 429 `ai_limit` (see GET /ai/status). Nothing is saved: apply the result to the draft and publish.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lang": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Target language (e.g. en, es, pt-PT)."
                  },
                  "texts": {
                    "maxItems": 300,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "description": "Texts to translate (up to 300 per request)."
                  },
                  "context": {
                    "description": "About the app, so the AI gets the tone and terms right.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "lang",
                  "texts"
                ]
              },
              "example": {
                "lang": "en",
                "texts": [
                  "Agendar horário",
                  "Escolha o barbeiro",
                  "Confirmar"
                ],
                "context": "App de agendamento de uma barbearia."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "lang": "en",
                  "strings": {
                    "Agendar horário": "Book an appointment",
                    "Escolha o barbeiro": "Choose your barber",
                    "Confirmar": "Confirm"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/tailorkit/ai/translate",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/seo/overview": {
      "get": {
        "operationId": "get-domains-id-seo-overview",
        "tags": [
          "SEO"
        ],
        "summary": "Domain SEO overview",
        "description": "Site settings, counts (pages, redirects, sitemap URLs), the latest audit, Search Console status and plan limits.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "site": {
                    "domainId": "dom_4h7n1q",
                    "hostname": "barbeariadoze.com.br",
                    "siteName": "Barbearia do Zé",
                    "locale": "pt_BR",
                    "twitterSite": "@barbeariadoze",
                    "robotsTxt": null,
                    "sitemapMode": "generate",
                    "sitemapUrl": "https://app.tenanci.com/seo/sitemap/dom_4h7n1q.xml",
                    "verification": {
                      "google": "q8Hn2vR5tW1xY4zA7bC0dE3fG6hJ9kL",
                      "bing": null
                    },
                    "prerenderEnabled": false,
                    "ogTemplate": {
                      "background": {
                        "kind": "gradient",
                        "color": "#0f172a",
                        "color2": "#1d4ed8",
                        "angle": 135
                      },
                      "textColor": "#ffffff",
                      "accentColor": "#38bdf8",
                      "logoAssetId": null,
                      "font": "inter",
                      "layout": "left",
                      "showSiteName": true,
                      "showDomain": true
                    },
                    "updatedAt": "2026-10-14T12:00:00.000Z"
                  },
                  "counts": {
                    "pages": 4,
                    "redirects": 12,
                    "sitemapUrls": 18
                  },
                  "lastAudit": {
                    "id": "aud_8t3w5y",
                    "domainId": "dom_4h7n1q",
                    "status": "done",
                    "trigger": "manual",
                    "maxPages": 500,
                    "pagesCrawled": 18,
                    "score": 84,
                    "summary": {
                      "issues": {
                        "high": 1,
                        "medium": 4,
                        "low": 3
                      },
                      "byCode": {
                        "fetch_error": {
                          "severity": "high",
                          "pages": 1,
                          "message": "Não foi possível carregar a página (timeout).",
                          "fix": "Verifique se a página está no ar e responde em até 10 segundos."
                        },
                        "description_missing": {
                          "severity": "medium",
                          "pages": 3,
                          "message": "A página não tem meta description.",
                          "fix": "Escreva uma descrição de 70 a 160 caracteres na aba Páginas."
                        },
                        "title_short": {
                          "severity": "medium",
                          "pages": 1,
                          "message": "Título curto (9 caracteres).",
                          "fix": "Use de 30 a 60 caracteres, com a palavra-chave principal no começo."
                        },
                        "img_alt_missing": {
                          "severity": "low",
                          "pages": 3,
                          "message": "2 imagens sem texto alternativo (alt).",
                          "fix": "Descreva cada imagem no atributo alt (acessibilidade e Google Imagens); imagens decorativas usam alt vazio."
                        },
                        "cwv_lcp_poor": {
                          "severity": "medium",
                          "pages": 1,
                          "message": "LCP (carregamento do maior elemento) ruim para visitantes reais (o ideal é até 2,5 s).",
                          "fix": "Otimize a imagem principal (WebP/AVIF, tamanho certo, fetchpriority=\"high\" e sem lazy-load), pré-carregue a fonte e a imagem do topo, adie CSS e JavaScript que bloqueiam a renderização e acelere a resposta do HTML."
                        }
                      },
                      "robotsTxt": {
                        "found": true,
                        "status": 200
                      },
                      "complete": true,
                      "quickWins": [
                        "description_missing",
                        "img_alt_missing",
                        "title_short"
                      ],
                      "pagesWithIssues": 6,
                      "fieldVitals": {
                        "status": "ok",
                        "from": "2026-09-16T12:00:00.000Z",
                        "to": "2026-10-14T12:00:00.000Z",
                        "days": 28,
                        "minSamples": 20,
                        "thresholds": {
                          "lcp": [
                            2500,
                            4000
                          ],
                          "inp": [
                            200,
                            500
                          ],
                          "cls": [
                            0.1,
                            0.25
                          ],
                          "fcp": [
                            1800,
                            3000
                          ],
                          "ttfb": [
                            800,
                            1800
                          ]
                        },
                        "domain": {
                          "mobile": {
                            "samples": 1840,
                            "lcp": {
                              "p75": 4300,
                              "samples": 1840,
                              "rating": "poor"
                            },
                            "inp": {
                              "p75": 140,
                              "samples": 1104,
                              "rating": "good"
                            },
                            "cls": {
                              "p75": 0.04,
                              "samples": 1840,
                              "rating": "good"
                            },
                            "fcp": {
                              "p75": 1200,
                              "samples": 1840,
                              "rating": "good"
                            },
                            "ttfb": {
                              "p75": 950,
                              "samples": 1840,
                              "rating": "needs_improvement"
                            }
                          },
                          "desktop": {
                            "samples": 610,
                            "lcp": {
                              "p75": 2100,
                              "samples": 610,
                              "rating": "good"
                            },
                            "inp": {
                              "p75": 140,
                              "samples": 366,
                              "rating": "good"
                            },
                            "cls": {
                              "p75": 0.04,
                              "samples": 610,
                              "rating": "good"
                            },
                            "fcp": {
                              "p75": 1200,
                              "samples": 610,
                              "rating": "good"
                            },
                            "ttfb": {
                              "p75": 450,
                              "samples": 610,
                              "rating": "good"
                            }
                          }
                        },
                        "worstPages": [
                          {
                            "path": "/agendar",
                            "device": "mobile",
                            "samples": 420,
                            "metrics": {
                              "lcp": {
                                "p75": 5100,
                                "samples": 420,
                                "rating": "poor"
                              },
                              "inp": {
                                "p75": 140,
                                "samples": 252,
                                "rating": "good"
                              },
                              "cls": {
                                "p75": 0.28,
                                "samples": 420,
                                "rating": "poor"
                              },
                              "fcp": {
                                "p75": 1200,
                                "samples": 420,
                                "rating": "good"
                              },
                              "ttfb": {
                                "p75": 450,
                                "samples": 420,
                                "rating": "good"
                              }
                            }
                          },
                          {
                            "path": "/",
                            "device": "mobile",
                            "samples": 900,
                            "metrics": {
                              "lcp": {
                                "p75": 3200,
                                "samples": 900,
                                "rating": "needs_improvement"
                              },
                              "inp": {
                                "p75": 140,
                                "samples": 540,
                                "rating": "good"
                              },
                              "cls": {
                                "p75": 0.04,
                                "samples": 900,
                                "rating": "good"
                              },
                              "fcp": {
                                "p75": 1200,
                                "samples": 900,
                                "rating": "good"
                              },
                              "ttfb": {
                                "p75": 450,
                                "samples": 900,
                                "rating": "good"
                              }
                            }
                          }
                        ],
                        "pagesMeasured": 2,
                        "findings": [
                          {
                            "code": "cwv_lcp_poor",
                            "scope": "domain",
                            "path": null,
                            "device": "mobile",
                            "metric": "lcp",
                            "p75": 4300,
                            "samples": 1840,
                            "severity": "medium"
                          },
                          {
                            "code": "cwv_lcp_poor",
                            "scope": "page",
                            "path": "/agendar",
                            "device": "mobile",
                            "metric": "lcp",
                            "p75": 5100,
                            "samples": 420,
                            "severity": "medium"
                          },
                          {
                            "code": "cwv_cls_poor",
                            "scope": "page",
                            "path": "/agendar",
                            "device": "mobile",
                            "metric": "cls",
                            "p75": 0.28,
                            "samples": 420,
                            "severity": "medium"
                          }
                        ]
                      }
                    },
                    "error": null,
                    "createdAt": "2026-10-14T12:00:00.000Z",
                    "startedAt": "2026-10-14T12:00:02.000Z",
                    "finishedAt": "2026-10-14T12:01:37.000Z"
                  },
                  "gsc": {
                    "configured": true,
                    "available": true,
                    "connected": true,
                    "googleEmail": "ze@barbeariadoze.com.br",
                    "propertyUrl": "https://barbeariadoze.com.br/",
                    "status": "verified",
                    "verified": true,
                    "lastSyncAt": "2026-10-14T06:10:00.000Z",
                    "backfilledAt": "2026-10-02T09:30:00.000Z",
                    "lastError": null
                  },
                  "plan": {
                    "code": "growth",
                    "advanced": true,
                    "maxAuditPages": 500,
                    "auditsPerDay": 10
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/overview",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/seo/site": {
      "get": {
        "operationId": "get-domains-id-seo-site",
        "tags": [
          "SEO"
        ],
        "summary": "Get site SEO settings",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "domainId": "dom_4h7n1q",
                  "hostname": "barbeariadoze.com.br",
                  "siteName": "Barbearia do Zé",
                  "locale": "pt_BR",
                  "twitterSite": "@barbeariadoze",
                  "robotsTxt": null,
                  "sitemapMode": "generate",
                  "sitemapUrl": "https://app.tenanci.com/seo/sitemap/dom_4h7n1q.xml",
                  "verification": {
                    "google": "q8Hn2vR5tW1xY4zA7bC0dE3fG6hJ9kL",
                    "bing": null
                  },
                  "prerenderEnabled": false,
                  "ogTemplate": {
                    "background": {
                      "kind": "gradient",
                      "color": "#0f172a",
                      "color2": "#1d4ed8",
                      "angle": 135
                    },
                    "textColor": "#ffffff",
                    "accentColor": "#38bdf8",
                    "logoAssetId": null,
                    "font": "inter",
                    "layout": "left",
                    "showSiteName": true,
                    "showDomain": true
                  },
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/site",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-seo-site",
        "tags": [
          "SEO"
        ],
        "summary": "Update site SEO settings",
        "description": "Omitted fields stay as they are. `prerenderEnabled: true` and `ogTemplate` require the Growth plan (403 `feature_not_in_plan`). The change is published to the edge right after.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "siteName": {
                    "description": "Site name (og:site_name and thumbnails).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "locale": {
                    "description": "Locale in pt_BR format (og:locale).",
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[a-z]{2,3}(_[A-Z]{2})?$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "twitterSite": {
                    "description": "Default X handle for the site.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sitemapMode": {
                    "description": "proxy: serves the origin's sitemap.xml; generate: Tenanci builds it from the registered URLs and those found by audits; off: no sitemap.",
                    "type": "string",
                    "enum": [
                      "proxy",
                      "generate",
                      "off"
                    ]
                  },
                  "prerenderEnabled": {
                    "description": "Pre-render pages for search bots (Growth plan).",
                    "type": "boolean"
                  },
                  "ogTemplate": {
                    "description": "Template for automatic thumbnails (Growth plan). null resets to the default.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "background": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "solid",
                                  "gradient"
                                ],
                                "description": "Solid color or gradient."
                              },
                              "color": {
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$",
                                "description": "Main color (#rrggbb)."
                              },
                              "color2": {
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$",
                                "description": "Second gradient color (#rrggbb)."
                              },
                              "angle": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 360,
                                "description": "Gradient angle in degrees."
                              }
                            },
                            "required": [
                              "kind",
                              "color",
                              "color2",
                              "angle"
                            ]
                          },
                          "textColor": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "accentColor": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "description": "Accent color."
                          },
                          "logoAssetId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 64
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Organization file (ast_…, from POST /assets) used as the logo; null = no logo."
                          },
                          "font": {
                            "type": "string",
                            "enum": [
                              "inter",
                              "lora"
                            ]
                          },
                          "layout": {
                            "type": "string",
                            "enum": [
                              "left",
                              "center",
                              "bottom"
                            ],
                            "description": "Title position on the card."
                          },
                          "showSiteName": {
                            "type": "boolean"
                          },
                          "showDomain": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "background",
                          "textColor",
                          "accentColor",
                          "logoAssetId",
                          "font",
                          "layout",
                          "showSiteName",
                          "showDomain"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "siteName": "Barbearia do Zé",
                "locale": "pt_BR",
                "twitterSite": "barbeariadoze",
                "sitemapMode": "generate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "domainId": "dom_4h7n1q",
                  "hostname": "barbeariadoze.com.br",
                  "siteName": "Barbearia do Zé",
                  "locale": "pt_BR",
                  "twitterSite": "@barbeariadoze",
                  "robotsTxt": null,
                  "sitemapMode": "generate",
                  "sitemapUrl": "https://app.tenanci.com/seo/sitemap/dom_4h7n1q.xml",
                  "verification": {
                    "google": "q8Hn2vR5tW1xY4zA7bC0dE3fG6hJ9kL",
                    "bing": null
                  },
                  "prerenderEnabled": false,
                  "ogTemplate": {
                    "background": {
                      "kind": "gradient",
                      "color": "#0f172a",
                      "color2": "#1d4ed8",
                      "angle": 135
                    },
                    "textColor": "#ffffff",
                    "accentColor": "#38bdf8",
                    "logoAssetId": null,
                    "font": "inter",
                    "layout": "left",
                    "showSiteName": true,
                    "showDomain": true
                  },
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/seo/site",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/pages": {
      "get": {
        "operationId": "get-domains-id-seo-pages",
        "tags": [
          "SEO"
        ],
        "summary": "List page SEO settings",
        "description": "The domain default (`pathPattern: null`) comes first, then patterns in alphabetical order.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "seo_7m2p4k",
                      "pathPattern": null,
                      "title": "Barbearia do Zé | Corte e barba no Centro",
                      "description": "Corte masculino, barba e sobrancelha no Centro. Agende online em poucos cliques e escolha o seu barbeiro.",
                      "imageUrl": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.jpg",
                      "image": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.jpg",
                        "width": 1200,
                        "height": 630,
                        "alt": "Fachada da Barbearia do Zé",
                        "assetId": "ast_5q8w2e"
                      },
                      "ogAuto": false,
                      "ogType": "website",
                      "twitterCard": "summary_large_image",
                      "twitterSite": "@barbeariadoze",
                      "canonical": null,
                      "robots": null,
                      "hreflang": [],
                      "jsonLd": [],
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    },
                    {
                      "id": "seo_3x9r6t",
                      "pathPattern": "/servicos",
                      "title": "Serviços e preços | Barbearia do Zé",
                      "description": "Corte, barba, pigmentação e pacotes para noivos. Veja os serviços da Barbearia do Zé e agende o seu horário.",
                      "imageUrl": null,
                      "image": null,
                      "ogAuto": true,
                      "ogType": "website",
                      "twitterCard": "summary_large_image",
                      "twitterSite": "@barbeariadoze",
                      "canonical": "https://barbeariadoze.com.br/servicos",
                      "robots": null,
                      "hreflang": [],
                      "jsonLd": [],
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/pages",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-domains-id-seo-pages",
        "tags": [
          "SEO"
        ],
        "summary": "Create page SEO settings",
        "description": "Title, description, social image, canonical, hreflang and JSON-LD for a path pattern. Settings already exist for the pattern? 409 `seo_path_exists` (use PATCH or PUT /domains/:id/seo). `ogAuto: true` requires the Growth plan.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pathPattern": {
                    "description": "Path pattern (e.g. /services or /blog/*, * only at the end). null/omitted = domain default (applies to pages without their own settings).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "description": "Title (<title> and og:title).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "description": "Meta description (and og:description).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "imageUrl": {
                    "description": "Compat: social image URL only. Prefer `image`.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "image": {
                    "description": "Social image (og:image). Use the variants from POST /domains/:id/seo/thumbnails. null removes it.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "width": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 10000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "height": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 10000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "alt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 420
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assetId": {
                            "description": "Organization file (ast_…) the image came from.",
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 64
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ogAuto": {
                    "description": "Thumbnail generated automatically from the site template when the page has no image of its own (Growth plan).",
                    "type": "boolean"
                  },
                  "ogType": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "website",
                          "article",
                          "product",
                          "profile"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "twitterCard": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "summary",
                          "summary_large_image"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "twitterSite": {
                    "description": "X handle (accepts \"shop\", \"@shop\" or the profile URL).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "canonical": {
                    "description": "Canonical URL.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "robots": {
                    "description": "Meta robots (e.g. noindex, nofollow).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hreflang": {
                    "description": "Versions of the page in other languages.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lang": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 20
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "format": "uri"
                        }
                      },
                      "required": [
                        "lang",
                        "url"
                      ]
                    }
                  },
                  "jsonLd": {
                    "description": "One block or a list (up to 20) of JSON-LD blocks. Validated before saving (see /seo/structured-data/validate).",
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "pathPattern": "/servicos",
                "title": "Serviços e preços | Barbearia do Zé",
                "description": "Corte, barba, pigmentação e pacotes para noivos. Veja os serviços da Barbearia do Zé e agende o seu horário.",
                "ogAuto": true,
                "ogType": "website",
                "twitterCard": "summary_large_image",
                "canonical": "https://barbeariadoze.com.br/servicos"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "seo_3x9r6t",
                  "pathPattern": "/servicos",
                  "title": "Serviços e preços | Barbearia do Zé",
                  "description": "Corte, barba, pigmentação e pacotes para noivos. Veja os serviços da Barbearia do Zé e agende o seu horário.",
                  "imageUrl": null,
                  "image": null,
                  "ogAuto": true,
                  "ogType": "website",
                  "twitterCard": "summary_large_image",
                  "twitterSite": "@barbeariadoze",
                  "canonical": "https://barbeariadoze.com.br/servicos",
                  "robots": null,
                  "hreflang": [],
                  "jsonLd": [],
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/pages",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/pages/{pageId}": {
      "patch": {
        "operationId": "patch-domains-id-seo-pages-pageid",
        "tags": [
          "SEO"
        ],
        "summary": "Update page SEO settings",
        "description": "Omitted fields stay as they are; null clears them. The domain default's `pathPattern` can't be changed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "Page settings id (seo_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pathPattern": {
                    "description": "Path pattern (e.g. /services or /blog/*, * only at the end). null/omitted = domain default (applies to pages without their own settings).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "description": "Title (<title> and og:title).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "description": "Meta description (and og:description).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "imageUrl": {
                    "description": "Compat: social image URL only. Prefer `image`.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "image": {
                    "description": "Social image (og:image). Use the variants from POST /domains/:id/seo/thumbnails. null removes it.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "width": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 10000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "height": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 10000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "alt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 420
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assetId": {
                            "description": "Organization file (ast_…) the image came from.",
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 64
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ogAuto": {
                    "description": "Thumbnail generated automatically from the site template when the page has no image of its own (Growth plan).",
                    "type": "boolean"
                  },
                  "ogType": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "website",
                          "article",
                          "product",
                          "profile"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "twitterCard": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "summary",
                          "summary_large_image"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "twitterSite": {
                    "description": "X handle (accepts \"shop\", \"@shop\" or the profile URL).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "canonical": {
                    "description": "Canonical URL.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "robots": {
                    "description": "Meta robots (e.g. noindex, nofollow).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hreflang": {
                    "description": "Versions of the page in other languages.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lang": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 20
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "format": "uri"
                        }
                      },
                      "required": [
                        "lang",
                        "url"
                      ]
                    }
                  },
                  "jsonLd": {
                    "description": "One block or a list (up to 20) of JSON-LD blocks. Validated before saving (see /seo/structured-data/validate).",
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "description": "Corte, barba e pigmentação com hora marcada. Veja os preços da Barbearia do Zé e agende online.",
                "robots": null
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "seo_3x9r6t",
                  "pathPattern": "/servicos",
                  "title": "Serviços e preços | Barbearia do Zé",
                  "description": "Corte, barba e pigmentação com hora marcada. Veja os preços da Barbearia do Zé e agende online.",
                  "imageUrl": null,
                  "image": null,
                  "ogAuto": true,
                  "ogType": "website",
                  "twitterCard": "summary_large_image",
                  "twitterSite": "@barbeariadoze",
                  "canonical": "https://barbeariadoze.com.br/servicos",
                  "robots": null,
                  "hreflang": [],
                  "jsonLd": [],
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/domains/:id/seo/pages/:pageId",
        "x-scope": "domains:write"
      },
      "delete": {
        "operationId": "delete-domains-id-seo-pages-pageid",
        "tags": [
          "SEO"
        ],
        "summary": "Delete page SEO settings",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "description": "Page settings id (seo_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/seo/pages/:pageId",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo": {
      "get": {
        "operationId": "get-domains-id-seo",
        "tags": [
          "SEO"
        ],
        "summary": "List page SEO settings (compat)",
        "description": "Same as GET /domains/:id/seo/pages; kept for older integrations.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "seo_7m2p4k",
                      "pathPattern": null,
                      "title": "Barbearia do Zé | Corte e barba no Centro",
                      "description": "Corte masculino, barba e sobrancelha no Centro. Agende online em poucos cliques e escolha o seu barbeiro.",
                      "imageUrl": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.jpg",
                      "image": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.jpg",
                        "width": 1200,
                        "height": 630,
                        "alt": "Fachada da Barbearia do Zé",
                        "assetId": "ast_5q8w2e"
                      },
                      "ogAuto": false,
                      "ogType": "website",
                      "twitterCard": "summary_large_image",
                      "twitterSite": "@barbeariadoze",
                      "canonical": null,
                      "robots": null,
                      "hreflang": [],
                      "jsonLd": [],
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    },
                    {
                      "id": "seo_3x9r6t",
                      "pathPattern": "/servicos",
                      "title": "Serviços e preços | Barbearia do Zé",
                      "description": "Corte, barba, pigmentação e pacotes para noivos. Veja os serviços da Barbearia do Zé e agende o seu horário.",
                      "imageUrl": null,
                      "image": null,
                      "ogAuto": true,
                      "ogType": "website",
                      "twitterCard": "summary_large_image",
                      "twitterSite": "@barbeariadoze",
                      "canonical": "https://barbeariadoze.com.br/servicos",
                      "robots": null,
                      "hreflang": [],
                      "jsonLd": [],
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-seo",
        "tags": [
          "SEO"
        ],
        "summary": "Create or update SEO by path pattern",
        "description": "Upsert by `pathPattern`: creates it if missing, otherwise updates it (omitted fields stay as they are). Without `pathPattern`, updates the domain default. Handy to apply suggestions from POST /domains/:id/seo/ai.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pathPattern": {
                    "description": "Path pattern (e.g. /services or /blog/*, * only at the end). null/omitted = domain default (applies to pages without their own settings).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "description": "Title (<title> and og:title).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "description": "Meta description (and og:description).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "imageUrl": {
                    "description": "Compat: social image URL only. Prefer `image`.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "image": {
                    "description": "Social image (og:image). Use the variants from POST /domains/:id/seo/thumbnails. null removes it.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "width": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 10000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "height": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 10000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "alt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 420
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assetId": {
                            "description": "Organization file (ast_…) the image came from.",
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 64
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ogAuto": {
                    "description": "Thumbnail generated automatically from the site template when the page has no image of its own (Growth plan).",
                    "type": "boolean"
                  },
                  "ogType": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "website",
                          "article",
                          "product",
                          "profile"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "twitterCard": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "summary",
                          "summary_large_image"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "twitterSite": {
                    "description": "X handle (accepts \"shop\", \"@shop\" or the profile URL).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "canonical": {
                    "description": "Canonical URL.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "robots": {
                    "description": "Meta robots (e.g. noindex, nofollow).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hreflang": {
                    "description": "Versions of the page in other languages.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lang": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 20
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "format": "uri"
                        }
                      },
                      "required": [
                        "lang",
                        "url"
                      ]
                    }
                  },
                  "jsonLd": {
                    "description": "One block or a list (up to 20) of JSON-LD blocks. Validated before saving (see /seo/structured-data/validate).",
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "pathPattern": null,
                "title": "Corte masculino e barba no Centro | Barbearia do Zé",
                "description": "Corte, barba e sobrancelha com hora marcada no Centro de São Paulo. Escolha o seu barbeiro e agende online na Barbearia do Zé."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "seo_7m2p4k",
                  "pathPattern": null,
                  "title": "Corte masculino e barba no Centro | Barbearia do Zé",
                  "description": "Corte, barba e sobrancelha com hora marcada no Centro de São Paulo. Escolha o seu barbeiro e agende online na Barbearia do Zé.",
                  "imageUrl": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.jpg",
                  "image": {
                    "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.jpg",
                    "width": 1200,
                    "height": 630,
                    "alt": "Fachada da Barbearia do Zé",
                    "assetId": "ast_5q8w2e"
                  },
                  "ogAuto": false,
                  "ogType": "website",
                  "twitterCard": "summary_large_image",
                  "twitterSite": "@barbeariadoze",
                  "canonical": null,
                  "robots": null,
                  "hreflang": [],
                  "jsonLd": [],
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/seo",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/{seoId}": {
      "delete": {
        "operationId": "delete-domains-id-seo-seoid",
        "tags": [
          "SEO"
        ],
        "summary": "Delete page SEO settings (compat)",
        "description": "Same as DELETE /domains/:id/seo/pages/:pageId.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "seoId",
            "in": "path",
            "required": true,
            "description": "Page settings id (seo_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/seo/:seoId",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/redirects": {
      "get": {
        "operationId": "get-domains-id-seo-redirects",
        "tags": [
          "SEO"
        ],
        "summary": "List redirects",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "rdr_6d1k8v",
                      "from": "/agendamento",
                      "to": "/agendar",
                      "status": 301,
                      "position": 0,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    },
                    {
                      "id": "rdr_9f4c2m",
                      "from": "/blog/promocao-dia-dos-pais",
                      "to": "/servicos",
                      "status": 301,
                      "position": 1,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/redirects",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-domains-id-seo-redirects",
        "tags": [
          "SEO"
        ],
        "summary": "Create a redirect",
        "description": "Redirect done at the edge, before the origin (good to keep the SEO of old addresses). Up to 5,000 per domain. Errors: 409 `redirect_exists` (duplicate source), 400 `redirect_loop`, `redirect_from_reserved`, `redirect_to_invalid`, `redirect_limit`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Old path (e.g. /old-booking). A full URL is also accepted (only the path is kept)."
                  },
                  "to": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Target: /path on the same domain or https://…."
                  },
                  "status": {
                    "description": "301 (default), 302, 307 or 308.",
                    "anyOf": [
                      {
                        "type": "number",
                        "const": 301
                      },
                      {
                        "type": "number",
                        "const": 302
                      },
                      {
                        "type": "number",
                        "const": 307
                      },
                      {
                        "type": "number",
                        "const": 308
                      }
                    ]
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              },
              "example": {
                "from": "/agendamento",
                "to": "/agendar",
                "status": 301
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "rdr_6d1k8v",
                  "from": "/agendamento",
                  "to": "/agendar",
                  "status": 301,
                  "position": 0,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/redirects",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/redirects/export": {
      "get": {
        "operationId": "get-domains-id-seo-redirects-export",
        "tags": [
          "SEO"
        ],
        "summary": "Export redirects as CSV",
        "description": "Columns from,to,status — the same format accepted by the import.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/csv": {
                "example": "from,to,status\n/agendamento,/agendar,301\n/blog/promocao-dia-dos-pais,/servicos,301\n"
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/redirects/export",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/seo/redirects/import": {
      "post": {
        "operationId": "post-domains-id-seo-redirects-import",
        "tags": [
          "SEO"
        ],
        "summary": "Import redirects from CSV",
        "description": "CSV with columns from,to[,status] (status defaults to 301; accepts `,` `;` or TAB and an optional header). Send it as JSON `{csv, mode, dryRun}`, as `text/csv` in the body or as multipart (`file` field); in those two cases `mode` and `dryRun` go in the query. `merge` updates existing sources and adds new ones; `replace` swaps the whole list. Invalid lines come back in `problems` and don't block the valid ones. With `dryRun: true`, it only simulates. Max 2 MB.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "For a text/csv or multipart body (default merge).",
            "schema": {
              "type": "string",
              "enum": [
                "merge",
                "replace"
              ]
            }
          },
          {
            "name": "dryRun",
            "in": "query",
            "required": false,
            "description": "For a text/csv or multipart body: simulate only.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "csv": {
                    "type": "string",
                    "maxLength": 2097152,
                    "description": "CSV content."
                  },
                  "mode": {
                    "description": "merge (default) or replace.",
                    "type": "string",
                    "enum": [
                      "merge",
                      "replace"
                    ]
                  },
                  "dryRun": {
                    "description": "Simulate only: returns the result without saving.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "csv"
                ]
              },
              "example": {
                "csv": "from,to,status\n/agendamento,/agendar,301\n/precos,/servicos\n/promo,,301\n",
                "mode": "merge",
                "dryRun": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "created": 1,
                  "updated": 1,
                  "removed": 0,
                  "problems": [
                    {
                      "line": 4,
                      "error": "to_invalid",
                      "raw": "/promo,,301"
                    }
                  ],
                  "total": 3,
                  "dryRun": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/redirects/import",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/redirects/{rid}": {
      "patch": {
        "operationId": "patch-domains-id-seo-redirects-rid",
        "tags": [
          "SEO"
        ],
        "summary": "Update a redirect",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "rid",
            "in": "path",
            "required": true,
            "description": "Redirect id (rdr_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Old path (e.g. /old-booking). A full URL is also accepted (only the path is kept)."
                  },
                  "to": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Target: /path on the same domain or https://…."
                  },
                  "status": {
                    "description": "301 (default), 302, 307 or 308.",
                    "anyOf": [
                      {
                        "type": "number",
                        "const": 301
                      },
                      {
                        "type": "number",
                        "const": 302
                      },
                      {
                        "type": "number",
                        "const": 307
                      },
                      {
                        "type": "number",
                        "const": 308
                      }
                    ]
                  },
                  "position": {
                    "description": "Position in the list.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              },
              "example": {
                "to": "/agendar-horario",
                "status": 308
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "rdr_6d1k8v",
                  "from": "/agendamento",
                  "to": "/agendar-horario",
                  "status": 308,
                  "position": 0,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/domains/:id/seo/redirects/:rid",
        "x-scope": "domains:write"
      },
      "delete": {
        "operationId": "delete-domains-id-seo-redirects-rid",
        "tags": [
          "SEO"
        ],
        "summary": "Delete a redirect",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "rid",
            "in": "path",
            "required": true,
            "description": "Redirect id (rdr_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/seo/redirects/:rid",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/robots": {
      "get": {
        "operationId": "get-domains-id-seo-robots",
        "tags": [
          "SEO"
        ],
        "summary": "Get robots.txt",
        "description": "`mode: origin` = the edge serves the origin's robots.txt; `custom` = serves `robotsTxt`. `presets` lists ready-made templates with the domain filled in.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "robotsTxt": null,
                  "mode": "origin",
                  "presets": [
                    {
                      "id": "allow_all",
                      "content": "User-agent: *\nAllow: /\n\nSitemap: https://barbeariadoze.com.br/sitemap.xml\n"
                    },
                    {
                      "id": "block_all",
                      "content": "User-agent: *\nDisallow: /\n"
                    },
                    {
                      "id": "block_ai",
                      "content": "User-agent: GPTBot\nDisallow: /\n\nUser-agent: ChatGPT-User\nDisallow: /\n\nUser-agent: OAI-SearchBot\nDisallow: /\n\nUser-agent: ClaudeBot\nDisallow: /\n\nUser-agent: Claude-Web\nDisallow: /\n\nUser-agent: anthropic-ai\nDisallow: /\n\nUser-agent: CCBot\nDisallow: /\n\nUser-agent: Google-Extended\nDisallow: /\n\nUser-agent: PerplexityBot\nDisallow: /\n\nUser-agent: Bytespider\nDisallow: /\n\nUser-agent: Applebot-Extended\nDisallow: /\n\nUser-agent: meta-externalagent\nDisallow: /\n\nUser-agent: Amazonbot\nDisallow: /\n\nUser-agent: cohere-ai\nDisallow: /\n\nUser-agent: Diffbot\nDisallow: /\n\nUser-agent: Omgilibot\nDisallow: /\n\nUser-agent: YouBot\nDisallow: /\n\nUser-agent: *\nAllow: /\n\nSitemap: https://barbeariadoze.com.br/sitemap.xml\n"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/robots",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-seo-robots",
        "tags": [
          "SEO"
        ],
        "summary": "Set robots.txt",
        "description": "Send a `preset` or the text in `robotsTxt` (`null` goes back to the origin's). The text is validated: 400 `invalid_robots` with the offending lines.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "robotsTxt": {
                    "description": "robots.txt content; null = use the origin's.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 65536
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "preset": {
                    "description": "Ready-made template (takes precedence over robotsTxt): allow all, block all or block AI crawlers.",
                    "type": "string",
                    "enum": [
                      "allow_all",
                      "block_all",
                      "block_ai"
                    ]
                  }
                }
              },
              "example": {
                "preset": "block_ai"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "robotsTxt": "User-agent: GPTBot\nDisallow: /\n\nUser-agent: ChatGPT-User\nDisallow: /\n\nUser-agent: OAI-SearchBot\nDisallow: /\n\nUser-agent: ClaudeBot\nDisallow: /\n\nUser-agent: Claude-Web\nDisallow: /\n\nUser-agent: anthropic-ai\nDisallow: /\n\nUser-agent: CCBot\nDisallow: /\n\nUser-agent: Google-Extended\nDisallow: /\n\nUser-agent: PerplexityBot\nDisallow: /\n\nUser-agent: Bytespider\nDisallow: /\n\nUser-agent: Applebot-Extended\nDisallow: /\n\nUser-agent: meta-externalagent\nDisallow: /\n\nUser-agent: Amazonbot\nDisallow: /\n\nUser-agent: cohere-ai\nDisallow: /\n\nUser-agent: Diffbot\nDisallow: /\n\nUser-agent: Omgilibot\nDisallow: /\n\nUser-agent: YouBot\nDisallow: /\n\nUser-agent: *\nAllow: /\n\nSitemap: https://barbeariadoze.com.br/sitemap.xml\n",
                  "mode": "custom",
                  "presets": [
                    {
                      "id": "allow_all",
                      "content": "User-agent: *\nAllow: /\n\nSitemap: https://barbeariadoze.com.br/sitemap.xml\n"
                    },
                    {
                      "id": "block_all",
                      "content": "User-agent: *\nDisallow: /\n"
                    },
                    {
                      "id": "block_ai",
                      "content": "User-agent: GPTBot\nDisallow: /\n\nUser-agent: ChatGPT-User\nDisallow: /\n\nUser-agent: OAI-SearchBot\nDisallow: /\n\nUser-agent: ClaudeBot\nDisallow: /\n\nUser-agent: Claude-Web\nDisallow: /\n\nUser-agent: anthropic-ai\nDisallow: /\n\nUser-agent: CCBot\nDisallow: /\n\nUser-agent: Google-Extended\nDisallow: /\n\nUser-agent: PerplexityBot\nDisallow: /\n\nUser-agent: Bytespider\nDisallow: /\n\nUser-agent: Applebot-Extended\nDisallow: /\n\nUser-agent: meta-externalagent\nDisallow: /\n\nUser-agent: Amazonbot\nDisallow: /\n\nUser-agent: cohere-ai\nDisallow: /\n\nUser-agent: Diffbot\nDisallow: /\n\nUser-agent: Omgilibot\nDisallow: /\n\nUser-agent: YouBot\nDisallow: /\n\nUser-agent: *\nAllow: /\n\nSitemap: https://barbeariadoze.com.br/sitemap.xml\n"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/seo/robots",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/sitemap": {
      "get": {
        "operationId": "get-domains-id-seo-sitemap",
        "tags": [
          "SEO"
        ],
        "summary": "Get the sitemap and its URLs",
        "description": "Sitemap mode, where it's served (`publicUrl`) and the URLs registered by hand (`manual`) or found by audits (`audit`).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items per page (default 100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Skip the first N items.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "description": "Only URLs from this source.",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "audit",
                "alias"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "mode": "generate",
                  "url": "https://app.tenanci.com/seo/sitemap/dom_4h7n1q.xml",
                  "publicUrl": "https://barbeariadoze.com.br/sitemap.xml",
                  "items": [
                    {
                      "id": "smu_4k7p1z",
                      "path": "/",
                      "lastmod": "2026-10-10T00:00:00.000Z",
                      "changefreq": null,
                      "priority": null,
                      "source": "audit",
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    },
                    {
                      "id": "smu_2h5n9b",
                      "path": "/servicos",
                      "lastmod": "2026-10-10T00:00:00.000Z",
                      "changefreq": "weekly",
                      "priority": 0.8,
                      "source": "manual",
                      "updatedAt": "2026-10-14T12:00:00.000Z"
                    }
                  ],
                  "total": 18
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/sitemap",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/seo/sitemap/urls": {
      "post": {
        "operationId": "post-domains-id-seo-sitemap-urls",
        "tags": [
          "SEO"
        ],
        "summary": "Add URLs to the sitemap",
        "description": "One URL or `{items: [...]}` with up to 5,000. An existing path is updated. Applies when the sitemap is in `generate` mode.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "path": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048,
                        "description": "Page path (e.g. /services). A full URL is also accepted."
                      },
                      "lastmod": {
                        "description": "Last modification date (ISO 8601).",
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 40
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "changefreq": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "always",
                              "hourly",
                              "daily",
                              "weekly",
                              "monthly",
                              "yearly",
                              "never"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "priority": {
                        "description": "Priority from 0 to 1.",
                        "anyOf": [
                          {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "path"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "items": {
                        "maxItems": 5000,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "path": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2048,
                              "description": "Page path (e.g. /services). A full URL is also accepted."
                            },
                            "lastmod": {
                              "description": "Last modification date (ISO 8601).",
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 40
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "changefreq": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "always",
                                    "hourly",
                                    "daily",
                                    "weekly",
                                    "monthly",
                                    "yearly",
                                    "never"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "priority": {
                              "description": "Priority from 0 to 1.",
                              "anyOf": [
                                {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "path"
                          ]
                        }
                      }
                    },
                    "required": [
                      "items"
                    ]
                  }
                ]
              },
              "example": {
                "items": [
                  {
                    "path": "/servicos",
                    "changefreq": "weekly",
                    "priority": 0.8
                  },
                  {
                    "path": "/agendar",
                    "lastmod": "2026-10-10",
                    "priority": 1
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "added": 2
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/sitemap/urls",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/sitemap/urls/{uid}": {
      "patch": {
        "operationId": "patch-domains-id-seo-sitemap-urls-uid",
        "tags": [
          "SEO"
        ],
        "summary": "Update a sitemap URL",
        "description": "A URL found by an audit becomes `manual` once edited.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uid",
            "in": "path",
            "required": true,
            "description": "Sitemap URL id (smu_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "description": "Page path (e.g. /services). A full URL is also accepted."
                  },
                  "lastmod": {
                    "description": "Last modification date (ISO 8601).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "changefreq": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "always",
                          "hourly",
                          "daily",
                          "weekly",
                          "monthly",
                          "yearly",
                          "never"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "priority": {
                    "description": "Priority from 0 to 1.",
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "priority": 0.9,
                "changefreq": "daily"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "smu_2h5n9b",
                  "path": "/servicos",
                  "lastmod": "2026-10-10T00:00:00.000Z",
                  "changefreq": "daily",
                  "priority": 0.9,
                  "source": "manual",
                  "updatedAt": "2026-10-14T12:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/domains/:id/seo/sitemap/urls/:uid",
        "x-scope": "domains:write"
      },
      "delete": {
        "operationId": "delete-domains-id-seo-sitemap-urls-uid",
        "tags": [
          "SEO"
        ],
        "summary": "Remove a sitemap URL",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uid",
            "in": "path",
            "required": true,
            "description": "Sitemap URL id (smu_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/seo/sitemap/urls/:uid",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/verification": {
      "get": {
        "operationId": "get-domains-id-seo-verification",
        "tags": [
          "SEO"
        ],
        "summary": "Get verification codes (Google, Bing)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "google": "q8Hn2vR5tW1xY4zA7bC0dE3fG6hJ9kL",
                  "bing": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/verification",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-seo-verification",
        "tags": [
          "SEO"
        ],
        "summary": "Set verification codes (Google, Bing)",
        "description": "The edge injects the verification meta tag into the pages' <head>. Accepts the code or the whole meta tag copied from Search Console/Bing; null or empty removes it. Invalid code: 400 `invalid_verification`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "google": {
                    "description": "google-site-verification (code or meta tag).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bing": {
                    "description": "msvalidate.01 (code or meta tag).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "google": "<meta name=\"google-site-verification\" content=\"q8Hn2vR5tW1xY4zA7bC0dE3fG6hJ9kL\" />",
                "bing": null
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "google": "q8Hn2vR5tW1xY4zA7bC0dE3fG6hJ9kL",
                  "bing": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/seo/verification",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/thumbnails": {
      "post": {
        "operationId": "post-domains-id-seo-thumbnails",
        "tags": [
          "SEO"
        ],
        "summary": "Upload a social thumbnail",
        "description": "`file` field (JPG, PNG, WebP, AVIF or GIF, up to 8 MB, shorter side ≥ 200 px). Generates og (1200×630), x (1200×600) and square (1080×1080) crops in WebP and JPEG. Without `focusX`/`focusY`, the crop looks for the most important region of the image. Use the returned URL in the pages' `image`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "focusX": {
                    "description": "Horizontal focus point, from 0 to 1 (send together with focusY).",
                    "type": "string"
                  },
                  "focusY": {
                    "description": "Vertical focus point, from 0 to 1.",
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "original": {
                    "width": 2400,
                    "height": 1600,
                    "format": "jpeg"
                  },
                  "variants": {
                    "og": {
                      "webp": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.webp",
                        "assetId": "ast_5q8w2f",
                        "width": 1200,
                        "height": 630,
                        "bytes": 84213,
                        "contentType": "image/webp"
                      },
                      "jpeg": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-og.jpg",
                        "assetId": "ast_5q8w2e",
                        "width": 1200,
                        "height": 630,
                        "bytes": 121877,
                        "contentType": "image/jpeg"
                      }
                    },
                    "x": {
                      "webp": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-x.webp",
                        "assetId": "ast_5q8w2h",
                        "width": 1200,
                        "height": 600,
                        "bytes": 80144,
                        "contentType": "image/webp"
                      },
                      "jpeg": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-x.jpg",
                        "assetId": "ast_5q8w2g",
                        "width": 1200,
                        "height": 600,
                        "bytes": 116302,
                        "contentType": "image/jpeg"
                      }
                    },
                    "square": {
                      "webp": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-square.webp",
                        "assetId": "ast_5q8w2k",
                        "width": 1080,
                        "height": 1080,
                        "bytes": 112590,
                        "contentType": "image/webp"
                      },
                      "jpeg": {
                        "url": "https://assets.tenanci.com/o/org_5t1v/seo/9c1e4b7a2d3f8e6051a7b2c4-square.jpg",
                        "assetId": "ast_5q8w2j",
                        "width": 1080,
                        "height": 1080,
                        "bytes": 168431,
                        "contentType": "image/jpeg"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/thumbnails",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/og/preview": {
      "post": {
        "operationId": "post-domains-id-seo-og-preview",
        "tags": [
          "SEO"
        ],
        "summary": "Preview an automatic thumbnail",
        "description": "Renders the PNG (1200×630) with the saved template or the one sent in `template`, without saving anything.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template": {
                    "description": "Template to try (default: the one saved on the site).",
                    "type": "object",
                    "properties": {
                      "background": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "solid",
                              "gradient"
                            ],
                            "description": "Solid color or gradient."
                          },
                          "color": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "description": "Main color (#rrggbb)."
                          },
                          "color2": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "description": "Second gradient color (#rrggbb)."
                          },
                          "angle": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 360,
                            "description": "Gradient angle in degrees."
                          }
                        },
                        "required": [
                          "kind",
                          "color",
                          "color2",
                          "angle"
                        ]
                      },
                      "textColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      },
                      "accentColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "description": "Accent color."
                      },
                      "logoAssetId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 64
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Organization file (ast_…, from POST /assets) used as the logo; null = no logo."
                      },
                      "font": {
                        "type": "string",
                        "enum": [
                          "inter",
                          "lora"
                        ]
                      },
                      "layout": {
                        "type": "string",
                        "enum": [
                          "left",
                          "center",
                          "bottom"
                        ],
                        "description": "Title position on the card."
                      },
                      "showSiteName": {
                        "type": "boolean"
                      },
                      "showDomain": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "background",
                      "textColor",
                      "accentColor",
                      "logoAssetId",
                      "font",
                      "layout",
                      "showSiteName",
                      "showDomain"
                    ]
                  },
                  "title": {
                    "description": "Title on the card (default: the domain default's).",
                    "type": "string",
                    "maxLength": 300
                  },
                  "siteName": {
                    "description": "Site name on the card.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "template": {
                  "background": {
                    "kind": "gradient",
                    "color": "#0f172a",
                    "color2": "#1d4ed8",
                    "angle": 135
                  },
                  "textColor": "#ffffff",
                  "accentColor": "#38bdf8",
                  "logoAssetId": null,
                  "font": "inter",
                  "layout": "left",
                  "showSiteName": true,
                  "showDomain": true
                },
                "title": "Serviços e preços | Barbearia do Zé",
                "siteName": "Barbearia do Zé"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "1200×630 PNG image"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/og/preview",
        "x-scope": "domains:read",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/seo/og/default-template": {
      "get": {
        "operationId": "get-domains-id-seo-og-default-template",
        "tags": [
          "SEO"
        ],
        "summary": "Default automatic thumbnail template",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "background": {
                    "kind": "gradient",
                    "color": "#0f172a",
                    "color2": "#1d4ed8",
                    "angle": 135
                  },
                  "textColor": "#ffffff",
                  "accentColor": "#38bdf8",
                  "logoAssetId": null,
                  "font": "inter",
                  "layout": "left",
                  "showSiteName": true,
                  "showDomain": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/og/default-template",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/seo/og/from-brand": {
      "post": {
        "operationId": "post-domains-id-seo-og-from-brand",
        "tags": [
          "SEO"
        ],
        "summary": "Thumbnail template from the customer's brand",
        "description": "Applies the colors and logo of the TailorKit theme published on the domain to the given `template`. Doesn't save: to use it, send the result to PUT /domains/:id/seo/site. `found: false` = the domain has no theme with a primary color (the template comes back unchanged).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template": {
                    "type": "object",
                    "properties": {
                      "background": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "solid",
                              "gradient"
                            ],
                            "description": "Solid color or gradient."
                          },
                          "color": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "description": "Main color (#rrggbb)."
                          },
                          "color2": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "description": "Second gradient color (#rrggbb)."
                          },
                          "angle": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 360,
                            "description": "Gradient angle in degrees."
                          }
                        },
                        "required": [
                          "kind",
                          "color",
                          "color2",
                          "angle"
                        ]
                      },
                      "textColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      },
                      "accentColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$",
                        "description": "Accent color."
                      },
                      "logoAssetId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 64
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Organization file (ast_…, from POST /assets) used as the logo; null = no logo."
                      },
                      "font": {
                        "type": "string",
                        "enum": [
                          "inter",
                          "lora"
                        ]
                      },
                      "layout": {
                        "type": "string",
                        "enum": [
                          "left",
                          "center",
                          "bottom"
                        ],
                        "description": "Title position on the card."
                      },
                      "showSiteName": {
                        "type": "boolean"
                      },
                      "showDomain": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "background",
                      "textColor",
                      "accentColor",
                      "logoAssetId",
                      "font",
                      "layout",
                      "showSiteName",
                      "showDomain"
                    ],
                    "description": "Current template (base for the suggestion)."
                  }
                },
                "required": [
                  "template"
                ]
              },
              "example": {
                "template": {
                  "background": {
                    "kind": "gradient",
                    "color": "#0f172a",
                    "color2": "#1d4ed8",
                    "angle": 135
                  },
                  "textColor": "#ffffff",
                  "accentColor": "#38bdf8",
                  "logoAssetId": null,
                  "font": "inter",
                  "layout": "left",
                  "showSiteName": true,
                  "showDomain": true
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "found": true,
                  "template": {
                    "background": {
                      "kind": "gradient",
                      "color": "#1f2937",
                      "color2": "#b45309",
                      "angle": 135
                    },
                    "textColor": "#ffffff",
                    "accentColor": "#b45309",
                    "logoAssetId": "ast_7r2m9d",
                    "font": "inter",
                    "layout": "left",
                    "showSiteName": true,
                    "showDomain": true
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/og/from-brand",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/seo/ai": {
      "post": {
        "operationId": "post-domains-id-seo-ai",
        "tags": [
          "SEO"
        ],
        "summary": "Suggest titles and descriptions with AI",
        "description": "Writes a title and description for each page for this domain's customer, based on what the domain publishes, the customer data (tenant context) and `about`. Only suggests: apply with PUT /domains/:id/seo. Without `paths`, uses the pages already configured, the home page and those from the latest audit (up to 15). The item with `path: null` is the domain default; `current` shows what's live. 429 `ai_limit` when the daily AI quota runs out.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paths": {
                    "description": "Pages (e.g. /services), up to 15.",
                    "maxItems": 15,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "about": {
                    "description": "What you know about the customer (neighborhood, specialties…).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "paths": [
                  "/",
                  "/servicos"
                ],
                "about": "Barbearia tradicional no Centro de São Paulo, especializada em corte na tesoura e barba com toalha quente."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "locale": "pt_BR",
                  "items": [
                    {
                      "path": null,
                      "title": "Corte masculino e barba no Centro | Barbearia do Zé",
                      "description": "Corte, barba e sobrancelha com hora marcada no Centro de São Paulo. Escolha o seu barbeiro e agende online na Barbearia do Zé.",
                      "current": {
                        "title": "Barbearia do Zé | Corte e barba no Centro",
                        "description": "Corte masculino, barba e sobrancelha no Centro. Agende online em poucos cliques e escolha o seu barbeiro."
                      }
                    },
                    {
                      "path": "/",
                      "title": "Corte masculino e barba no Centro | Barbearia do Zé",
                      "description": "Corte, barba e sobrancelha com hora marcada no Centro de São Paulo. Escolha o seu barbeiro e agende online na Barbearia do Zé.",
                      "current": {
                        "title": "Barbearia do Zé",
                        "description": null
                      }
                    },
                    {
                      "path": "/servicos",
                      "title": "Serviços e preços de corte e barba | Barbearia do Zé",
                      "description": "Veja os serviços da Barbearia do Zé: corte, barba, pigmentação e pacotes para noivos. Confira os valores e reserve o seu horário.",
                      "current": {
                        "title": "Serviços",
                        "description": null
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/ai",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/seo/audits": {
      "post": {
        "operationId": "post-domains-id-seo-audits",
        "tags": [
          "SEO"
        ],
        "summary": "Start an SEO audit",
        "description": "Crawls the site (up to 25 pages; 500 on Growth and 2,000 on Scale) and flags issues per page. Runs in the background: follow it at GET /domains/:id/seo/audits/:auditId. Indexable pages found go into the sitemap. Errors: 409 `domain_not_active`, 409 `audit_running`, 429 `audit_limit` (3, 10 or 20 per day, depending on the plan).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "aud_8t3w5y",
                  "domainId": "dom_4h7n1q",
                  "status": "queued",
                  "trigger": "manual",
                  "maxPages": 500,
                  "pagesCrawled": 0,
                  "score": null,
                  "summary": null,
                  "error": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "startedAt": null,
                  "finishedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/audits",
        "x-scope": "domains:write"
      },
      "get": {
        "operationId": "get-domains-id-seo-audits",
        "tags": [
          "SEO"
        ],
        "summary": "List audits",
        "description": "Most recent first. Includes the automatic weekly ones (`trigger: schedule`).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items (default 20).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "aud_8t3w5y",
                      "domainId": "dom_4h7n1q",
                      "status": "done",
                      "trigger": "manual",
                      "maxPages": 500,
                      "pagesCrawled": 18,
                      "score": 84,
                      "summary": {
                        "issues": {
                          "high": 1,
                          "medium": 4,
                          "low": 3
                        },
                        "byCode": {
                          "fetch_error": {
                            "severity": "high",
                            "pages": 1,
                            "message": "Não foi possível carregar a página (timeout).",
                            "fix": "Verifique se a página está no ar e responde em até 10 segundos."
                          },
                          "description_missing": {
                            "severity": "medium",
                            "pages": 3,
                            "message": "A página não tem meta description.",
                            "fix": "Escreva uma descrição de 70 a 160 caracteres na aba Páginas."
                          },
                          "title_short": {
                            "severity": "medium",
                            "pages": 1,
                            "message": "Título curto (9 caracteres).",
                            "fix": "Use de 30 a 60 caracteres, com a palavra-chave principal no começo."
                          },
                          "img_alt_missing": {
                            "severity": "low",
                            "pages": 3,
                            "message": "2 imagens sem texto alternativo (alt).",
                            "fix": "Descreva cada imagem no atributo alt (acessibilidade e Google Imagens); imagens decorativas usam alt vazio."
                          },
                          "cwv_lcp_poor": {
                            "severity": "medium",
                            "pages": 1,
                            "message": "LCP (carregamento do maior elemento) ruim para visitantes reais (o ideal é até 2,5 s).",
                            "fix": "Otimize a imagem principal (WebP/AVIF, tamanho certo, fetchpriority=\"high\" e sem lazy-load), pré-carregue a fonte e a imagem do topo, adie CSS e JavaScript que bloqueiam a renderização e acelere a resposta do HTML."
                          }
                        },
                        "robotsTxt": {
                          "found": true,
                          "status": 200
                        },
                        "complete": true,
                        "quickWins": [
                          "description_missing",
                          "img_alt_missing",
                          "title_short"
                        ],
                        "pagesWithIssues": 6,
                        "fieldVitals": {
                          "status": "ok",
                          "from": "2026-09-16T12:00:00.000Z",
                          "to": "2026-10-14T12:00:00.000Z",
                          "days": 28,
                          "minSamples": 20,
                          "thresholds": {
                            "lcp": [
                              2500,
                              4000
                            ],
                            "inp": [
                              200,
                              500
                            ],
                            "cls": [
                              0.1,
                              0.25
                            ],
                            "fcp": [
                              1800,
                              3000
                            ],
                            "ttfb": [
                              800,
                              1800
                            ]
                          },
                          "domain": {
                            "mobile": {
                              "samples": 1840,
                              "lcp": {
                                "p75": 4300,
                                "samples": 1840,
                                "rating": "poor"
                              },
                              "inp": {
                                "p75": 140,
                                "samples": 1104,
                                "rating": "good"
                              },
                              "cls": {
                                "p75": 0.04,
                                "samples": 1840,
                                "rating": "good"
                              },
                              "fcp": {
                                "p75": 1200,
                                "samples": 1840,
                                "rating": "good"
                              },
                              "ttfb": {
                                "p75": 950,
                                "samples": 1840,
                                "rating": "needs_improvement"
                              }
                            },
                            "desktop": {
                              "samples": 610,
                              "lcp": {
                                "p75": 2100,
                                "samples": 610,
                                "rating": "good"
                              },
                              "inp": {
                                "p75": 140,
                                "samples": 366,
                                "rating": "good"
                              },
                              "cls": {
                                "p75": 0.04,
                                "samples": 610,
                                "rating": "good"
                              },
                              "fcp": {
                                "p75": 1200,
                                "samples": 610,
                                "rating": "good"
                              },
                              "ttfb": {
                                "p75": 450,
                                "samples": 610,
                                "rating": "good"
                              }
                            }
                          },
                          "worstPages": [
                            {
                              "path": "/agendar",
                              "device": "mobile",
                              "samples": 420,
                              "metrics": {
                                "lcp": {
                                  "p75": 5100,
                                  "samples": 420,
                                  "rating": "poor"
                                },
                                "inp": {
                                  "p75": 140,
                                  "samples": 252,
                                  "rating": "good"
                                },
                                "cls": {
                                  "p75": 0.28,
                                  "samples": 420,
                                  "rating": "poor"
                                },
                                "fcp": {
                                  "p75": 1200,
                                  "samples": 420,
                                  "rating": "good"
                                },
                                "ttfb": {
                                  "p75": 450,
                                  "samples": 420,
                                  "rating": "good"
                                }
                              }
                            },
                            {
                              "path": "/",
                              "device": "mobile",
                              "samples": 900,
                              "metrics": {
                                "lcp": {
                                  "p75": 3200,
                                  "samples": 900,
                                  "rating": "needs_improvement"
                                },
                                "inp": {
                                  "p75": 140,
                                  "samples": 540,
                                  "rating": "good"
                                },
                                "cls": {
                                  "p75": 0.04,
                                  "samples": 900,
                                  "rating": "good"
                                },
                                "fcp": {
                                  "p75": 1200,
                                  "samples": 900,
                                  "rating": "good"
                                },
                                "ttfb": {
                                  "p75": 450,
                                  "samples": 900,
                                  "rating": "good"
                                }
                              }
                            }
                          ],
                          "pagesMeasured": 2,
                          "findings": [
                            {
                              "code": "cwv_lcp_poor",
                              "scope": "domain",
                              "path": null,
                              "device": "mobile",
                              "metric": "lcp",
                              "p75": 4300,
                              "samples": 1840,
                              "severity": "medium"
                            },
                            {
                              "code": "cwv_lcp_poor",
                              "scope": "page",
                              "path": "/agendar",
                              "device": "mobile",
                              "metric": "lcp",
                              "p75": 5100,
                              "samples": 420,
                              "severity": "medium"
                            },
                            {
                              "code": "cwv_cls_poor",
                              "scope": "page",
                              "path": "/agendar",
                              "device": "mobile",
                              "metric": "cls",
                              "p75": 0.28,
                              "samples": 420,
                              "severity": "medium"
                            }
                          ]
                        }
                      },
                      "error": null,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "startedAt": "2026-10-14T12:00:02.000Z",
                      "finishedAt": "2026-10-14T12:01:37.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/audits",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/seo/audits/{auditId}": {
      "get": {
        "operationId": "get-domains-id-seo-audits-auditid",
        "tags": [
          "SEO"
        ],
        "summary": "Get an audit and its pages",
        "description": "Pages from worst to best score, with their issues and how to fix them. `summary.fieldVitals` has the real visitors' Web Vitals (28-day p75 from analytics, for mobile and desktop: LCP, INP, CLS, FCP and TTFB with Google's rating; `p75: null` = fewer than `minSamples` measurements) and the worst pages; poor metrics become `cwv_<metric>_poor` issues. `status` says whether there was data: `ok`, `no_analytics` (plan without analytics), `no_beacon` (browser script off) or `unavailable`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "auditId",
            "in": "path",
            "required": true,
            "description": "Audit id (aud_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "description": "Only issues of this severity (and only pages that have them).",
            "schema": {
              "type": "string",
              "enum": [
                "high",
                "medium",
                "low"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "aud_8t3w5y",
                  "domainId": "dom_4h7n1q",
                  "status": "done",
                  "trigger": "manual",
                  "maxPages": 500,
                  "pagesCrawled": 18,
                  "score": 84,
                  "summary": {
                    "issues": {
                      "high": 1,
                      "medium": 4,
                      "low": 3
                    },
                    "byCode": {
                      "fetch_error": {
                        "severity": "high",
                        "pages": 1,
                        "message": "Não foi possível carregar a página (timeout).",
                        "fix": "Verifique se a página está no ar e responde em até 10 segundos."
                      },
                      "description_missing": {
                        "severity": "medium",
                        "pages": 3,
                        "message": "A página não tem meta description.",
                        "fix": "Escreva uma descrição de 70 a 160 caracteres na aba Páginas."
                      },
                      "title_short": {
                        "severity": "medium",
                        "pages": 1,
                        "message": "Título curto (9 caracteres).",
                        "fix": "Use de 30 a 60 caracteres, com a palavra-chave principal no começo."
                      },
                      "img_alt_missing": {
                        "severity": "low",
                        "pages": 3,
                        "message": "2 imagens sem texto alternativo (alt).",
                        "fix": "Descreva cada imagem no atributo alt (acessibilidade e Google Imagens); imagens decorativas usam alt vazio."
                      },
                      "cwv_lcp_poor": {
                        "severity": "medium",
                        "pages": 1,
                        "message": "LCP (carregamento do maior elemento) ruim para visitantes reais (o ideal é até 2,5 s).",
                        "fix": "Otimize a imagem principal (WebP/AVIF, tamanho certo, fetchpriority=\"high\" e sem lazy-load), pré-carregue a fonte e a imagem do topo, adie CSS e JavaScript que bloqueiam a renderização e acelere a resposta do HTML."
                      }
                    },
                    "robotsTxt": {
                      "found": true,
                      "status": 200
                    },
                    "complete": true,
                    "quickWins": [
                      "description_missing",
                      "img_alt_missing",
                      "title_short"
                    ],
                    "pagesWithIssues": 6,
                    "fieldVitals": {
                      "status": "ok",
                      "from": "2026-09-16T12:00:00.000Z",
                      "to": "2026-10-14T12:00:00.000Z",
                      "days": 28,
                      "minSamples": 20,
                      "thresholds": {
                        "lcp": [
                          2500,
                          4000
                        ],
                        "inp": [
                          200,
                          500
                        ],
                        "cls": [
                          0.1,
                          0.25
                        ],
                        "fcp": [
                          1800,
                          3000
                        ],
                        "ttfb": [
                          800,
                          1800
                        ]
                      },
                      "domain": {
                        "mobile": {
                          "samples": 1840,
                          "lcp": {
                            "p75": 4300,
                            "samples": 1840,
                            "rating": "poor"
                          },
                          "inp": {
                            "p75": 140,
                            "samples": 1104,
                            "rating": "good"
                          },
                          "cls": {
                            "p75": 0.04,
                            "samples": 1840,
                            "rating": "good"
                          },
                          "fcp": {
                            "p75": 1200,
                            "samples": 1840,
                            "rating": "good"
                          },
                          "ttfb": {
                            "p75": 950,
                            "samples": 1840,
                            "rating": "needs_improvement"
                          }
                        },
                        "desktop": {
                          "samples": 610,
                          "lcp": {
                            "p75": 2100,
                            "samples": 610,
                            "rating": "good"
                          },
                          "inp": {
                            "p75": 140,
                            "samples": 366,
                            "rating": "good"
                          },
                          "cls": {
                            "p75": 0.04,
                            "samples": 610,
                            "rating": "good"
                          },
                          "fcp": {
                            "p75": 1200,
                            "samples": 610,
                            "rating": "good"
                          },
                          "ttfb": {
                            "p75": 450,
                            "samples": 610,
                            "rating": "good"
                          }
                        }
                      },
                      "worstPages": [
                        {
                          "path": "/agendar",
                          "device": "mobile",
                          "samples": 420,
                          "metrics": {
                            "lcp": {
                              "p75": 5100,
                              "samples": 420,
                              "rating": "poor"
                            },
                            "inp": {
                              "p75": 140,
                              "samples": 252,
                              "rating": "good"
                            },
                            "cls": {
                              "p75": 0.28,
                              "samples": 420,
                              "rating": "poor"
                            },
                            "fcp": {
                              "p75": 1200,
                              "samples": 420,
                              "rating": "good"
                            },
                            "ttfb": {
                              "p75": 450,
                              "samples": 420,
                              "rating": "good"
                            }
                          }
                        },
                        {
                          "path": "/",
                          "device": "mobile",
                          "samples": 900,
                          "metrics": {
                            "lcp": {
                              "p75": 3200,
                              "samples": 900,
                              "rating": "needs_improvement"
                            },
                            "inp": {
                              "p75": 140,
                              "samples": 540,
                              "rating": "good"
                            },
                            "cls": {
                              "p75": 0.04,
                              "samples": 900,
                              "rating": "good"
                            },
                            "fcp": {
                              "p75": 1200,
                              "samples": 900,
                              "rating": "good"
                            },
                            "ttfb": {
                              "p75": 450,
                              "samples": 900,
                              "rating": "good"
                            }
                          }
                        }
                      ],
                      "pagesMeasured": 2,
                      "findings": [
                        {
                          "code": "cwv_lcp_poor",
                          "scope": "domain",
                          "path": null,
                          "device": "mobile",
                          "metric": "lcp",
                          "p75": 4300,
                          "samples": 1840,
                          "severity": "medium"
                        },
                        {
                          "code": "cwv_lcp_poor",
                          "scope": "page",
                          "path": "/agendar",
                          "device": "mobile",
                          "metric": "lcp",
                          "p75": 5100,
                          "samples": 420,
                          "severity": "medium"
                        },
                        {
                          "code": "cwv_cls_poor",
                          "scope": "page",
                          "path": "/agendar",
                          "device": "mobile",
                          "metric": "cls",
                          "p75": 0.28,
                          "samples": 420,
                          "severity": "medium"
                        }
                      ]
                    }
                  },
                  "error": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "startedAt": "2026-10-14T12:00:02.000Z",
                  "finishedAt": "2026-10-14T12:01:37.000Z",
                  "pages": [
                    {
                      "path": "/promocoes",
                      "statusCode": 200,
                      "score": 62,
                      "title": "Promoções",
                      "loadMs": 840,
                      "bytes": 48211,
                      "issues": [
                        {
                          "code": "title_short",
                          "severity": "medium",
                          "message": "Título curto (9 caracteres).",
                          "fix": "Use de 30 a 60 caracteres, com a palavra-chave principal no começo.",
                          "details": {
                            "title": "Promoções"
                          }
                        },
                        {
                          "code": "description_missing",
                          "severity": "medium",
                          "message": "A página não tem meta description.",
                          "fix": "Escreva uma descrição de 70 a 160 caracteres na aba Páginas."
                        }
                      ]
                    },
                    {
                      "path": "/",
                      "statusCode": 200,
                      "score": 100,
                      "title": "Barbearia do Zé | Corte e barba no Centro",
                      "loadMs": 412,
                      "bytes": 61530,
                      "issues": []
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/audits/:auditId",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/seo/gsc": {
      "get": {
        "operationId": "get-domains-id-seo-gsc",
        "tags": [
          "SEO"
        ],
        "summary": "Google Search Console status",
        "description": "`available` tells whether the plan includes the integration (Growth). Connecting to Google is done in the dashboard.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "configured": true,
                  "available": true,
                  "connected": true,
                  "googleEmail": "ze@barbeariadoze.com.br",
                  "propertyUrl": "https://barbeariadoze.com.br/",
                  "status": "verified",
                  "verified": true,
                  "lastSyncAt": "2026-10-14T06:10:00.000Z",
                  "backfilledAt": "2026-10-02T09:30:00.000Z",
                  "lastError": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/gsc",
        "x-scope": "domains:read"
      },
      "delete": {
        "operationId": "delete-domains-id-seo-gsc",
        "tags": [
          "SEO"
        ],
        "summary": "Disconnect Search Console",
        "description": "Revokes Google access and deletes the domain's imported data.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/seo/gsc",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/seo/gsc/sync": {
      "post": {
        "operationId": "post-domains-id-seo-gsc-sync",
        "tags": [
          "SEO"
        ],
        "summary": "Sync Search Console now",
        "description": "Queues the import (which already runs daily). If the property isn't verified yet, queues the verification instead (`queued: verify`). Without a connection: 400 `gsc_not_connected`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "queued": "sync"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/seo/gsc/sync",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/seo/gsc/timeseries": {
      "get": {
        "operationId": "get-domains-id-seo-gsc-timeseries",
        "tags": [
          "SEO"
        ],
        "summary": "Clicks and impressions per day (Search Console)",
        "description": "`ctr` is a fraction (0.05 = 5%); `position` is the impression-weighted average position.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start date (YYYY-MM-DD). Default: 28 days ago.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End date (YYYY-MM-DD). Default: today.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Only this page (exact URL, as in Search Console).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Only this search query (exact text).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "date": "2026-10-12",
                      "clicks": 18,
                      "impressions": 402,
                      "ctr": 0.0448,
                      "position": 8.4
                    },
                    {
                      "date": "2026-10-13",
                      "clicks": 23,
                      "impressions": 455,
                      "ctr": 0.0505,
                      "position": 7.9
                    }
                  ],
                  "totals": {
                    "clicks": 41,
                    "impressions": 857,
                    "ctr": 0.0478,
                    "position": 8.13
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/gsc/timeseries",
        "x-scope": "domains:read",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/seo/gsc/queries": {
      "get": {
        "operationId": "get-domains-id-seo-gsc-queries",
        "tags": [
          "SEO"
        ],
        "summary": "Top search queries (Search Console)",
        "description": "Sorted by clicks and impressions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start date (YYYY-MM-DD). Default: 28 days ago.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End date (YYYY-MM-DD). Default: today.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Only this page (exact URL, as in Search Console).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Only this search query (exact text).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items (default 50, max 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "key": "barbearia centro sp",
                      "clicks": 31,
                      "impressions": 512,
                      "ctr": 0.0605,
                      "position": 3.2
                    },
                    {
                      "key": "barbearia do zé",
                      "clicks": 27,
                      "impressions": 64,
                      "ctr": 0.4219,
                      "position": 1.1
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/gsc/queries",
        "x-scope": "domains:read",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/seo/gsc/pages": {
      "get": {
        "operationId": "get-domains-id-seo-gsc-pages",
        "tags": [
          "SEO"
        ],
        "summary": "Top pages (Search Console)",
        "description": "Sorted by clicks and impressions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Domain id (dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start date (YYYY-MM-DD). Default: 28 days ago.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End date (YYYY-MM-DD). Default: today.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Only this page (exact URL, as in Search Console).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Only this search query (exact text).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items (default 50, max 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "key": "https://barbeariadoze.com.br/",
                      "clicks": 52,
                      "impressions": 610,
                      "ctr": 0.0852,
                      "position": 2.4
                    },
                    {
                      "key": "https://barbeariadoze.com.br/servicos",
                      "clicks": 14,
                      "impressions": 247,
                      "ctr": 0.0567,
                      "position": 6.8
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/seo/gsc/pages",
        "x-scope": "domains:read",
        "x-plan": "growth"
      }
    },
    "/seo/structured-data/types": {
      "get": {
        "operationId": "get-seo-structured-data-types",
        "tags": [
          "SEO"
        ],
        "summary": "Available structured data types",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    "Organization",
                    "LocalBusiness",
                    "Product",
                    "Article",
                    "FAQPage",
                    "BreadcrumbList"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/seo/structured-data/types",
        "x-scope": "domains:read"
      }
    },
    "/seo/structured-data/build": {
      "post": {
        "operationId": "post-seo-structured-data-build",
        "tags": [
          "SEO"
        ],
        "summary": "Build JSON-LD from a form",
        "description": "Builds the schema.org block for the chosen `type` (Organization, LocalBusiness, Product, Article, FAQPage, BreadcrumbList) and validates it. Use the returned `jsonLd` in the pages' `jsonLd` field. Doesn't save.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "Organization"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "logo": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "description": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "email": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "email",
                                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "telephone": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sameAs": {
                            "default": [],
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          }
                        },
                        "required": [
                          "name",
                          "url"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "LocalBusiness"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "businessType": {
                            "default": "LocalBusiness",
                            "type": "string",
                            "pattern": "^[A-Z][A-Za-z]{2,60}$"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "url": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "image": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "telephone": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "priceRange": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "address": {
                            "type": "object",
                            "properties": {
                              "streetAddress": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "addressLocality": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "addressRegion": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "postalCode": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "addressCountry": {
                                "default": "BR",
                                "type": "string",
                                "minLength": 2,
                                "maxLength": 2
                              }
                            },
                            "required": [
                              "streetAddress",
                              "addressLocality"
                            ]
                          },
                          "geo": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "latitude": {
                                    "type": "number",
                                    "minimum": -90,
                                    "maximum": 90
                                  },
                                  "longitude": {
                                    "type": "number",
                                    "minimum": -180,
                                    "maximum": 180
                                  }
                                },
                                "required": [
                                  "latitude",
                                  "longitude"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "openingHours": {
                            "default": [],
                            "maxItems": 14,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "days": {
                                  "minItems": 1,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "enum": [
                                      "Mo",
                                      "Tu",
                                      "We",
                                      "Th",
                                      "Fr",
                                      "Sa",
                                      "Su"
                                    ]
                                  }
                                },
                                "opens": {
                                  "type": "string",
                                  "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                                },
                                "closes": {
                                  "type": "string",
                                  "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                                }
                              },
                              "required": [
                                "days",
                                "opens",
                                "closes"
                              ]
                            }
                          }
                        },
                        "required": [
                          "name",
                          "address"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "Product"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "description": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 5000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "image": {
                            "minItems": 1,
                            "maxItems": 10,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "sku": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "brand": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "offers": {
                            "type": "object",
                            "properties": {
                              "price": {
                                "type": "number",
                                "minimum": 0
                              },
                              "priceCurrency": {
                                "default": "BRL",
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "availability": {
                                "default": "InStock",
                                "type": "string",
                                "enum": [
                                  "InStock",
                                  "OutOfStock",
                                  "PreOrder",
                                  "Discontinued",
                                  "LimitedAvailability"
                                ]
                              },
                              "url": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 2048,
                                    "format": "uri"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "priceValidUntil": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "price"
                            ]
                          },
                          "aggregateRating": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "ratingValue": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 5
                                  },
                                  "reviewCount": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "ratingValue",
                                  "reviewCount"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "image",
                          "offers"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "Article"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "articleType": {
                            "default": "Article",
                            "type": "string",
                            "enum": [
                              "Article",
                              "BlogPosting",
                              "NewsArticle"
                            ]
                          },
                          "headline": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 110
                          },
                          "description": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1000
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "image": {
                            "minItems": 1,
                            "maxItems": 10,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "authorName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "authorUrl": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "publisherName": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "publisherLogo": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "datePublished": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              },
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              }
                            ]
                          },
                          "dateModified": {
                            "anyOf": [
                              {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                  },
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  }
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "headline",
                          "image",
                          "authorName",
                          "datePublished"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "FAQPage"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "questions": {
                            "minItems": 1,
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "question": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                },
                                "answer": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 5000
                                }
                              },
                              "required": [
                                "question",
                                "answer"
                              ]
                            }
                          }
                        },
                        "required": [
                          "questions"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "BreadcrumbList"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "items": {
                            "minItems": 1,
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "url": {
                                  "type": "string",
                                  "maxLength": 2048,
                                  "format": "uri"
                                }
                              },
                              "required": [
                                "name",
                                "url"
                              ]
                            }
                          }
                        },
                        "required": [
                          "items"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "data"
                    ]
                  }
                ]
              },
              "example": {
                "type": "LocalBusiness",
                "data": {
                  "businessType": "HairSalon",
                  "name": "Barbearia do Zé",
                  "url": "https://barbeariadoze.com.br/",
                  "telephone": "+55 11 99999-1234",
                  "priceRange": "$$",
                  "address": {
                    "streetAddress": "Rua Augusta, 1200",
                    "addressLocality": "São Paulo",
                    "addressRegion": "SP",
                    "postalCode": "01304-001",
                    "addressCountry": "BR"
                  },
                  "openingHours": [
                    {
                      "days": [
                        "Tu",
                        "We",
                        "Th",
                        "Fr"
                      ],
                      "opens": "09:00",
                      "closes": "20:00"
                    },
                    {
                      "days": [
                        "Sa"
                      ],
                      "opens": "08:00",
                      "closes": "16:00"
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "jsonLd": {
                    "@context": "https://schema.org",
                    "@type": "HairSalon",
                    "name": "Barbearia do Zé",
                    "url": "https://barbeariadoze.com.br/",
                    "telephone": "+55 11 99999-1234",
                    "priceRange": "$$",
                    "address": {
                      "@type": "PostalAddress",
                      "streetAddress": "Rua Augusta, 1200",
                      "addressLocality": "São Paulo",
                      "addressRegion": "SP",
                      "postalCode": "01304-001",
                      "addressCountry": "BR"
                    },
                    "openingHoursSpecification": [
                      {
                        "@type": "OpeningHoursSpecification",
                        "dayOfWeek": [
                          "Tuesday",
                          "Wednesday",
                          "Thursday",
                          "Friday"
                        ],
                        "opens": "09:00",
                        "closes": "20:00"
                      },
                      {
                        "@type": "OpeningHoursSpecification",
                        "dayOfWeek": [
                          "Saturday"
                        ],
                        "opens": "08:00",
                        "closes": "16:00"
                      }
                    ]
                  },
                  "valid": true,
                  "issues": []
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/seo/structured-data/build",
        "x-scope": "domains:read"
      }
    },
    "/seo/structured-data/validate": {
      "post": {
        "operationId": "post-seo-structured-data-validate",
        "tags": [
          "SEO"
        ],
        "summary": "Validate JSON-LD",
        "description": "Checks `@context`, `@type`, the required fields (errors) and the recommended ones (warnings) for Google rich results. Accepts one block or a list. Errors prevent saving the JSON-LD on a page.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "jsonLd": {
                    "description": "One JSON-LD block (object) or a list of blocks."
                  }
                },
                "required": [
                  "jsonLd"
                ]
              },
              "example": {
                "jsonLd": {
                  "@context": "https://schema.org",
                  "@type": "LocalBusiness",
                  "name": "Barbearia do Zé",
                  "telephone": "+55 11 99999-1234"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "valid": false,
                  "issues": [
                    {
                      "path": "$[0].address",
                      "level": "error",
                      "message": "LocalBusiness: campo obrigatório \"address\" ausente"
                    },
                    {
                      "path": "$[0].openingHoursSpecification",
                      "level": "warning",
                      "message": "LocalBusiness: campo recomendado \"openingHoursSpecification\" ausente"
                    },
                    {
                      "path": "$[0].geo",
                      "level": "warning",
                      "message": "LocalBusiness: campo recomendado \"geo\" ausente"
                    },
                    {
                      "path": "$[0].url",
                      "level": "warning",
                      "message": "LocalBusiness: campo recomendado \"url\" ausente"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/seo/structured-data/validate",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/marketing": {
      "get": {
        "operationId": "get-domains-id-marketing",
        "tags": [
          "Marketing"
        ],
        "summary": "Get tags, cookie banner and links",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "settings": {
                    "consent": {
                      "banner": true,
                      "text": "Usamos cookies para medir as visitas e melhorar os anúncios.",
                      "policyUrl": "https://barbeariadoze.com.br/privacidade",
                      "position": "bottom",
                      "color": "#1f2937"
                    },
                    "tags": {
                      "ga4": "G-7KX2M9QL4P",
                      "gtm": null,
                      "googleAds": "AW-1098765432",
                      "metaPixel": "873214569012345",
                      "tiktok": null,
                      "linkedin": null,
                      "clarity": "k8m3x9q2ab",
                      "hotjar": null,
                      "pinterest": null
                    },
                    "firstParty": true
                  },
                  "links": [
                    {
                      "id": "lnk_6p2w9r",
                      "slug": "promo-outubro",
                      "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-outubro",
                      "name": "Bio do Instagram",
                      "shortUrl": "https://barbeariadoze.com.br/l/promo-outubro",
                      "createdAt": "2026-10-14T12:30:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/marketing",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-marketing",
        "tags": [
          "Marketing"
        ],
        "summary": "Configure tags and cookie banner",
        "description": "Replaces the whole configuration: a tag missing from the body is turned off. The edge starts injecting the tags (and the banner, if on) on every page of the domain. Short links have their own routes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "consent": {
                    "description": "Cookie banner (GDPR/LGPD). Omitted fields go back to the default.",
                    "type": "object",
                    "properties": {
                      "banner": {
                        "description": "Cookie banner with accept/reject (Consent Mode v2). Without it, tags load right away.",
                        "type": "boolean"
                      },
                      "text": {
                        "description": "Banner text (empty = default text).",
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 600
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "policyUrl": {
                        "description": "Privacy policy link (http/https).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "position": {
                        "description": "Banner position.",
                        "type": "string",
                        "enum": [
                          "bottom",
                          "bottom-left",
                          "bottom-right"
                        ]
                      },
                      "color": {
                        "description": "Button color in hex (#RRGGBB).",
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "tags": {
                    "description": "Ids of the tags and pixels the edge injects. An omitted or empty tag is turned off.",
                    "type": "object",
                    "properties": {
                      "ga4": {
                        "description": "Google Analytics 4 (G-XXXXXXXX).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "gtm": {
                        "description": "Google Tag Manager (GTM-XXXXXX).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "googleAds": {
                        "description": "Google Ads (AW-123456789).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "metaPixel": {
                        "description": "Meta Pixel (digits only).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "tiktok": {
                        "description": "TikTok Pixel.",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "linkedin": {
                        "description": "LinkedIn Insight Tag (partner id, digits only).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "clarity": {
                        "description": "Microsoft Clarity (project id).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "hotjar": {
                        "description": "Hotjar (site id, digits only).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "pinterest": {
                        "description": "Pinterest Tag (digits only).",
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "firstParty": {
                    "type": "boolean",
                    "description": "Serve the vendors' scripts from the domain itself (/__tenanci/t/…): they survive ad blockers."
                  }
                },
                "required": [
                  "firstParty"
                ],
                "additionalProperties": false
              },
              "example": {
                "consent": {
                  "banner": true,
                  "text": "Usamos cookies para medir as visitas e melhorar os anúncios.",
                  "policyUrl": "https://barbeariadoze.com.br/privacidade",
                  "position": "bottom",
                  "color": "#1f2937"
                },
                "tags": {
                  "ga4": "G-7KX2M9QL4P",
                  "gtm": null,
                  "googleAds": "AW-1098765432",
                  "metaPixel": "873214569012345",
                  "tiktok": null,
                  "linkedin": null,
                  "clarity": "k8m3x9q2ab",
                  "hotjar": null,
                  "pinterest": null
                },
                "firstParty": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "settings": {
                    "consent": {
                      "banner": true,
                      "text": "Usamos cookies para medir as visitas e melhorar os anúncios.",
                      "policyUrl": "https://barbeariadoze.com.br/privacidade",
                      "position": "bottom",
                      "color": "#1f2937"
                    },
                    "tags": {
                      "ga4": "G-7KX2M9QL4P",
                      "gtm": null,
                      "googleAds": "AW-1098765432",
                      "metaPixel": "873214569012345",
                      "tiktok": null,
                      "linkedin": null,
                      "clarity": "k8m3x9q2ab",
                      "hotjar": null,
                      "pinterest": null
                    },
                    "firstParty": true
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/marketing",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/links": {
      "get": {
        "operationId": "get-domains-id-links",
        "tags": [
          "Marketing"
        ],
        "summary": "List campaign links",
        "description": "Clicks per link: GET /domains/:id/analytics/campaigns.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "lnk_6p2w9r",
                      "slug": "promo-outubro",
                      "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-outubro",
                      "name": "Bio do Instagram",
                      "shortUrl": "https://barbeariadoze.com.br/l/promo-outubro",
                      "createdAt": "2026-10-14T12:30:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/links",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-domains-id-links",
        "tags": [
          "Marketing"
        ],
        "summary": "Create a campaign link",
        "description": "Short link on the customer's domain (https://<domain>/l/<slug>) that redirects to `url` and counts the click. Up to 500 per domain; a repeated slug returns 409 `slug_taken`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Short link path: https://<domain>/l/<slug>. Lowercase letters, digits and hyphens."
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Target (http/https), with the UTMs already in it."
                  },
                  "name": {
                    "description": "A name you'll recognize.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "slug",
                  "url"
                ]
              },
              "example": {
                "slug": "promo-outubro",
                "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-outubro",
                "name": "Bio do Instagram"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "lnk_6p2w9r",
                  "slug": "promo-outubro",
                  "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-outubro",
                  "name": "Bio do Instagram",
                  "shortUrl": "https://barbeariadoze.com.br/l/promo-outubro",
                  "createdAt": "2026-10-14T12:30:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/links",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/links/{linkId}": {
      "patch": {
        "operationId": "patch-domains-id-links-linkid",
        "tags": [
          "Marketing"
        ],
        "summary": "Update a campaign link",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "description": "Link id (lnk_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Short link path: https://<domain>/l/<slug>. Lowercase letters, digits and hyphens."
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Target (http/https), with the UTMs already in it."
                  },
                  "name": {
                    "description": "A name you'll recognize.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-novembro"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "lnk_6p2w9r",
                  "slug": "promo-outubro",
                  "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-novembro",
                  "name": "Bio do Instagram",
                  "shortUrl": "https://barbeariadoze.com.br/l/promo-outubro",
                  "createdAt": "2026-10-14T12:30:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/domains/:id/links/:linkId",
        "x-scope": "domains:write"
      },
      "delete": {
        "operationId": "delete-domains-id-links-linkid",
        "tags": [
          "Marketing"
        ],
        "summary": "Delete a campaign link",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "description": "Link id (lnk_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/links/:linkId",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/goals": {
      "get": {
        "operationId": "get-domains-id-goals",
        "tags": [
          "Marketing"
        ],
        "summary": "List page goals",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "gol_3t8k1v",
                      "name": "Lead",
                      "pathPattern": "/obrigado",
                      "value": 50,
                      "currency": "BRL",
                      "createdAt": "2026-10-14T12:40:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/goals",
        "x-scope": "domains:read"
      },
      "post": {
        "operationId": "post-domains-id-goals",
        "tags": [
          "Marketing"
        ],
        "summary": "Create a page goal",
        "description": "Counts a conversion when the visitor opens the page (e.g. /thank-you), without touching the app's code. Up to 50 per domain. With server-side conversions on, the goal also goes to Meta, TikTok and GA4.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 60,
                    "description": "Goal name: letters, digits, spaces and _ (e.g. Lead, Purchase)."
                  },
                  "pathPattern": {
                    "type": "string",
                    "maxLength": 300,
                    "description": "Page: /thank-you (exact), /order/* (it and below) or /order* (starts with). A full URL is accepted."
                  },
                  "value": {
                    "description": "Conversion value (>= 0).",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "currency": {
                    "description": "Currency (3 letters; BRL by default when there's a value).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 3
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "pathPattern"
                ]
              },
              "example": {
                "name": "Lead",
                "pathPattern": "/obrigado",
                "value": 50,
                "currency": "BRL"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "gol_3t8k1v",
                  "name": "Lead",
                  "pathPattern": "/obrigado",
                  "value": 50,
                  "currency": "BRL",
                  "createdAt": "2026-10-14T12:40:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/goals",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/goals/{goalId}": {
      "delete": {
        "operationId": "delete-domains-id-goals-goalid",
        "tags": [
          "Marketing"
        ],
        "summary": "Delete a page goal",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "goalId",
            "in": "path",
            "required": true,
            "description": "Goal id (gol_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/goals/:goalId",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/conversions": {
      "get": {
        "operationId": "get-domains-id-conversions",
        "tags": [
          "Marketing"
        ],
        "summary": "Get server-side conversions",
        "description": "One row per provider (meta, ga4, tiktok). `hasPixel` tells whether the matching tag id is set in PUT /domains/:id/marketing; without it nothing is sent.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "provider": "meta",
                      "configured": true,
                      "enabled": true,
                      "hasPixel": true,
                      "testCode": "TEST48213",
                      "lastSentAt": "2026-10-21T18:22:05.000Z",
                      "lastError": null,
                      "lastErrorAt": null
                    },
                    {
                      "provider": "ga4",
                      "configured": false,
                      "enabled": false,
                      "hasPixel": true,
                      "testCode": null,
                      "lastSentAt": null,
                      "lastError": null,
                      "lastErrorAt": null
                    },
                    {
                      "provider": "tiktok",
                      "configured": false,
                      "enabled": false,
                      "hasPixel": false,
                      "testCode": null,
                      "lastSentAt": null,
                      "lastError": null,
                      "lastErrorAt": null
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/conversions",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/conversions/{provider}": {
      "put": {
        "operationId": "put-domains-id-conversions-provider",
        "tags": [
          "Marketing"
        ],
        "summary": "Configure server-side conversions",
        "description": "Goals also go from the server to the provider (they survive ad blockers), only with the visitor's consent when the banner is on. Meta and TikTok deduplicate against the browser pixel; GA4 only receives page goals. The token is stored encrypted and never returned. With a dashboard session, owner/admin only.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "description": "Provider: meta (Conversions API), ga4 (Measurement Protocol) or tiktok (Events API)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "secret": {
                    "description": "Provider token (Meta: Conversions API access token; GA4: Measurement Protocol API secret; TikTok: Events API access token). Required the first time.",
                    "type": "string",
                    "maxLength": 1000
                  },
                  "testCode": {
                    "description": "Meta/TikTok test code (events show up in \"Test events\"). null removes it.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "enabled": {
                    "description": "Turns sending on/off without deleting the token.",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "secret": "TOKEN_DE_ACESSO_DA_META",
                "testCode": "TEST48213"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "provider": "meta",
                  "configured": true,
                  "enabled": true,
                  "hasPixel": true,
                  "testCode": "TEST48213",
                  "lastSentAt": null,
                  "lastError": null,
                  "lastErrorAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/conversions/:provider",
        "x-scope": "domains:write",
        "x-plan": "landing"
      },
      "delete": {
        "operationId": "delete-domains-id-conversions-provider",
        "tags": [
          "Marketing"
        ],
        "summary": "Remove server-side conversions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "description": "Provider: meta (Conversions API), ga4 (Measurement Protocol) or tiktok (Events API)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/conversions/:provider",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/conversions/{provider}/test": {
      "post": {
        "operationId": "post-domains-id-conversions-provider-test",
        "tags": [
          "Marketing"
        ],
        "summary": "Send a test event",
        "description": "Sends a `TenanciTest` event to the provider right now and returns the result (`detail` carries the provider's response on failure). For GA4 it uses the validation endpoint.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "description": "Provider: meta (Conversions API), ga4 (Measurement Protocol) or tiktok (Events API)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "detail": ""
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/conversions/:provider/test",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/costs": {
      "get": {
        "operationId": "get-domains-id-costs",
        "tags": [
          "Marketing"
        ],
        "summary": "List campaign costs",
        "description": "Spend per campaign (utm_campaign) shows up in GET /domains/:id/analytics/campaigns as cost, cost per conversion and return.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "cst_9d4m2x",
                      "campaign": "promo-outubro",
                      "source": "instagram",
                      "startsOn": "2026-10-01",
                      "endsOn": "2026-10-31",
                      "amount": 1200,
                      "currency": "BRL"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/costs",
        "x-scope": "domains:read",
        "x-plan": "landing"
      },
      "post": {
        "operationId": "post-domains-id-costs",
        "tags": [
          "Marketing"
        ],
        "summary": "Add campaign costs",
        "description": "1 to 500 rows per call. Each entry is spread over the days of its period when computing the cost for a range. Different currencies are not converted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "campaign": {
                          "type": "string",
                          "maxLength": 200,
                          "description": "Campaign: the same value as utm_campaign."
                        },
                        "source": {
                          "description": "Source (utm_source), optional.",
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 100
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "startsOn": {
                          "type": "string",
                          "maxLength": 10,
                          "description": "First day (YYYY-MM-DD)."
                        },
                        "endsOn": {
                          "type": "string",
                          "maxLength": 10,
                          "description": "Last day, inclusive (YYYY-MM-DD)."
                        },
                        "amount": {
                          "type": "number",
                          "description": "Amount spent in the period (e.g. 1200.50)."
                        },
                        "currency": {
                          "description": "Currency (default BRL).",
                          "type": "string",
                          "maxLength": 3
                        }
                      },
                      "required": [
                        "campaign",
                        "startsOn",
                        "endsOn",
                        "amount"
                      ]
                    }
                  }
                },
                "required": [
                  "items"
                ]
              },
              "example": {
                "items": [
                  {
                    "campaign": "promo-outubro",
                    "source": "instagram",
                    "startsOn": "2026-10-01",
                    "endsOn": "2026-10-31",
                    "amount": 1200,
                    "currency": "BRL"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "created": 1
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/costs",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/costs/{costId}": {
      "delete": {
        "operationId": "delete-domains-id-costs-costid",
        "tags": [
          "Marketing"
        ],
        "summary": "Delete a cost entry",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "costId",
            "in": "path",
            "required": true,
            "description": "Cost entry id (cst_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/costs/:costId",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/split-tests": {
      "get": {
        "operationId": "get-domains-id-split-tests",
        "tags": [
          "A/B tests"
        ],
        "summary": "List A/B tests",
        "description": "`runningLimit` counts the tests running across the whole organization (all domains) and carries the plan cap in `max` (`null` = no cap; the Landing plan allows 5). Over the cap, POST …/start returns 409 `split_limit`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "lp-corte-de-outubro-k3x9",
                      "name": "Corte de outubro",
                      "path": "/oferta",
                      "scope": "path",
                      "status": "draft",
                      "goal": "Lead",
                      "variants": [
                        {
                          "key": "a",
                          "name": "Original (A)",
                          "url": "https://lp.agendafacil.com/barbearia-do-ze/",
                          "weight": 50
                        },
                        {
                          "key": "b",
                          "name": "Com vídeo",
                          "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
                          "weight": 50
                        }
                      ],
                      "winner": null,
                      "autoStop": true,
                      "mode": "fixed",
                      "rebalancedAt": null,
                      "startedAt": null,
                      "endedAt": null,
                      "createdAt": "2026-10-15T10:00:00.000Z",
                      "url": "https://barbeariadoze.com.br/oferta"
                    }
                  ],
                  "runningLimit": {
                    "running": 2,
                    "max": 5
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/split-tests",
        "x-scope": "domains:read",
        "x-plan": "landing"
      },
      "post": {
        "operationId": "post-domains-id-split-tests",
        "tags": [
          "A/B tests"
        ],
        "summary": "Create an A/B test",
        "description": "The edge assigns each visitor and serves their landing page on the domain's own address. It starts as a draft (`draft`); start it with POST …/start. Up to 50 tests per domain. Results: GET /domains/:id/analytics/experiments/:exp with the test id.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "Test name."
                  },
                  "path": {
                    "description": "Address on the domain where the test runs (default /).",
                    "type": "string",
                    "maxLength": 300
                  },
                  "scope": {
                    "description": "path (default): only the entry page and what it loads; host: the whole domain belongs to the test.",
                    "type": "string",
                    "enum": [
                      "host",
                      "path"
                    ]
                  },
                  "goal": {
                    "description": "Goal that decides the test (name used in tenanci.track() or in a page goal). Required to start.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "variants": {
                    "maxItems": 4,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "description": "Variant name (default: Original (A), Variante B…).",
                          "type": "string",
                          "maxLength": 60
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "description": "Landing page address (on another host, not on the test's own domain)."
                        },
                        "weight": {
                          "description": "Traffic percentage (0–100). When given, they must add up to 100; without weights, traffic is split evenly.",
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    "description": "2 to 4 landing pages; the first one is the control (a)."
                  },
                  "autoStop": {
                    "description": "End on its own once there's a safe winner (default true) and notify by email.",
                    "type": "boolean"
                  },
                  "mode": {
                    "description": "fixed (default): fixed percentages; bandit: shifts traffic toward the winning page.",
                    "type": "string",
                    "enum": [
                      "fixed",
                      "bandit"
                    ]
                  }
                },
                "required": [
                  "name",
                  "variants"
                ]
              },
              "example": {
                "name": "Corte de outubro",
                "path": "/oferta",
                "goal": "Lead",
                "variants": [
                  {
                    "url": "https://lp.agendafacil.com/barbearia-do-ze/"
                  },
                  {
                    "name": "Com vídeo",
                    "url": "https://lp.agendafacil.com/barbearia-do-ze-video/"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "lp-corte-de-outubro-k3x9",
                  "name": "Corte de outubro",
                  "path": "/oferta",
                  "scope": "path",
                  "status": "draft",
                  "goal": "Lead",
                  "variants": [
                    {
                      "key": "a",
                      "name": "Original (A)",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
                      "weight": 50
                    },
                    {
                      "key": "b",
                      "name": "Com vídeo",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
                      "weight": 50
                    }
                  ],
                  "winner": null,
                  "autoStop": true,
                  "mode": "fixed",
                  "rebalancedAt": null,
                  "startedAt": null,
                  "endedAt": null,
                  "createdAt": "2026-10-15T10:00:00.000Z",
                  "url": "https://barbeariadoze.com.br/oferta"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/split-tests",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/split-tests/check-url": {
      "post": {
        "operationId": "post-domains-id-split-tests-check-url",
        "tags": [
          "A/B tests"
        ],
        "summary": "Check a landing page",
        "description": "Opens the URL the way the edge will and warns about what may go wrong: errors, not HTML, redirects to another domain, absolute <base href> or a script that checks its own address.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Landing page address."
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://lp.agendafacil.com/barbearia-do-ze-video/"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "status": 200,
                  "finalUrl": "https://lp.agendafacil.com/barbearia-do-ze-video/",
                  "title": "Barbearia do Zé | Agende seu corte",
                  "warnings": []
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/split-tests/check-url",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/split-tests/{testId}": {
      "get": {
        "operationId": "get-domains-id-split-tests-testid",
        "tags": [
          "A/B tests"
        ],
        "summary": "Get an A/B test",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "description": "Test id (lp-…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "lp-corte-de-outubro-k3x9",
                  "name": "Corte de outubro",
                  "path": "/oferta",
                  "scope": "path",
                  "status": "draft",
                  "goal": "Lead",
                  "variants": [
                    {
                      "key": "a",
                      "name": "Original (A)",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
                      "weight": 50
                    },
                    {
                      "key": "b",
                      "name": "Com vídeo",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
                      "weight": 50
                    }
                  ],
                  "winner": null,
                  "autoStop": true,
                  "mode": "fixed",
                  "rebalancedAt": null,
                  "startedAt": null,
                  "endedAt": null,
                  "createdAt": "2026-10-15T10:00:00.000Z",
                  "url": "https://barbeariadoze.com.br/oferta"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/split-tests/:testId",
        "x-scope": "domains:read",
        "x-plan": "landing"
      },
      "patch": {
        "operationId": "patch-domains-id-split-tests-testid",
        "tags": [
          "A/B tests"
        ],
        "summary": "Update an A/B test",
        "description": "The same fields as creation, all optional. Landing pages, address and scope only change while draft or paused (and, when paused, without changing the number of pages). The goal can't change once ended.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "description": "Test id (lp-…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "Test name."
                  },
                  "path": {
                    "description": "Address on the domain where the test runs (default /).",
                    "type": "string",
                    "maxLength": 300
                  },
                  "scope": {
                    "description": "path (default): only the entry page and what it loads; host: the whole domain belongs to the test.",
                    "type": "string",
                    "enum": [
                      "host",
                      "path"
                    ]
                  },
                  "goal": {
                    "description": "Goal that decides the test (name used in tenanci.track() or in a page goal). Required to start.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "variants": {
                    "maxItems": 4,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "description": "Variant name (default: Original (A), Variante B…).",
                          "type": "string",
                          "maxLength": 60
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "description": "Landing page address (on another host, not on the test's own domain)."
                        },
                        "weight": {
                          "description": "Traffic percentage (0–100). When given, they must add up to 100; without weights, traffic is split evenly.",
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "url"
                      ]
                    },
                    "description": "2 to 4 landing pages; the first one is the control (a)."
                  },
                  "autoStop": {
                    "description": "End on its own once there's a safe winner (default true) and notify by email.",
                    "type": "boolean"
                  },
                  "mode": {
                    "description": "fixed (default): fixed percentages; bandit: shifts traffic toward the winning page.",
                    "type": "string",
                    "enum": [
                      "fixed",
                      "bandit"
                    ]
                  }
                }
              },
              "example": {
                "mode": "bandit",
                "autoStop": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "lp-corte-de-outubro-k3x9",
                  "name": "Corte de outubro",
                  "path": "/oferta",
                  "scope": "path",
                  "status": "draft",
                  "goal": "Lead",
                  "variants": [
                    {
                      "key": "a",
                      "name": "Original (A)",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
                      "weight": 50
                    },
                    {
                      "key": "b",
                      "name": "Com vídeo",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
                      "weight": 50
                    }
                  ],
                  "winner": null,
                  "autoStop": false,
                  "mode": "bandit",
                  "rebalancedAt": null,
                  "startedAt": null,
                  "endedAt": null,
                  "createdAt": "2026-10-15T10:00:00.000Z",
                  "url": "https://barbeariadoze.com.br/oferta"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/domains/:id/split-tests/:testId",
        "x-scope": "domains:write",
        "x-plan": "landing"
      },
      "delete": {
        "operationId": "delete-domains-id-split-tests-testid",
        "tags": [
          "A/B tests"
        ],
        "summary": "Delete an A/B test",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "description": "Test id (lp-…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/split-tests/:testId",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/split-tests/{testId}/{action}": {
      "post": {
        "operationId": "post-domains-id-split-tests-testid-action",
        "tags": [
          "A/B tests"
        ],
        "summary": "Start, pause, resume, end or archive",
        "description": "`draft → running ⇄ paused → ended → archived`. start requires the goal; start/resume return 409 if another active test uses the same address (`split_overlap`) or the plan's limit of running tests was reached (`split_limit`). end requires `winner` and sends every visitor to the winner; archive takes the test offline. The body is only used by end.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "description": "Test id (lp-…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "in": "path",
            "required": true,
            "description": "start, pause, resume, end or archive",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "winner": {
                    "description": "Winning variant (end only).",
                    "type": "string",
                    "enum": [
                      "a",
                      "b",
                      "c",
                      "d"
                    ]
                  }
                }
              },
              "example": {
                "winner": "b"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "lp-corte-de-outubro-k3x9",
                  "name": "Corte de outubro",
                  "path": "/oferta",
                  "scope": "path",
                  "status": "ended",
                  "goal": "Lead",
                  "variants": [
                    {
                      "key": "a",
                      "name": "Original (A)",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
                      "weight": 50
                    },
                    {
                      "key": "b",
                      "name": "Com vídeo",
                      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
                      "weight": 50
                    }
                  ],
                  "winner": "b",
                  "autoStop": true,
                  "mode": "fixed",
                  "rebalancedAt": null,
                  "startedAt": "2026-10-15T10:05:00.000Z",
                  "endedAt": "2026-10-22T09:00:00.000Z",
                  "createdAt": "2026-10-15T10:00:00.000Z",
                  "url": "https://barbeariadoze.com.br/oferta"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/split-tests/:testId/:action",
        "x-scope": "domains:write",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/overview": {
      "get": {
        "operationId": "get-domains-id-analytics-overview",
        "tags": [
          "Analytics"
        ],
        "summary": "Period overview",
        "description": "Visitors, pageviews, sessions, bounce rate, duration, requests, traffic, error rate and latency. Every plan with analytics. On Starter (basic analytics): up to 31 days back, no `compare`, `includeBots` or filters.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "visitors": 1843,
                  "pageviews": 5127,
                  "sessions": 2210,
                  "bounceRate": 0.412,
                  "avgDurationMs": 94300,
                  "requests": 48211,
                  "bytes": 1873402211,
                  "errorRate": 0.0031,
                  "p50Ms": 87,
                  "p95Ms": 412,
                  "previous": {
                    "visitors": 1610,
                    "pageviews": 4480,
                    "sessions": 1932,
                    "bounceRate": 0.438,
                    "avgDurationMs": 88100,
                    "requests": 43990,
                    "bytes": 1702334120,
                    "errorRate": 0.0042,
                    "p50Ms": 91,
                    "p95Ms": 455
                  },
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/overview",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/analytics/timeseries": {
      "get": {
        "operationId": "get-domains-id-analytics-timeseries",
        "tags": [
          "Analytics"
        ],
        "summary": "Time series of a metric",
        "description": "One point per bucket (`interval`), empty ones included. On Starter, only visitors, pageviews and requests. Every plan with analytics. On Starter (basic analytics): up to 31 days back, no `compare`, `includeBots` or filters.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "metric",
            "in": "query",
            "required": false,
            "description": "Metric (default visitors).",
            "schema": {
              "type": "string",
              "enum": [
                "visitors",
                "pageviews",
                "requests",
                "bytes",
                "errors",
                "latency_p95",
                "sessions"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "metric": "visitors",
                  "points": [
                    {
                      "t": "2026-10-15T03:00:00.000Z",
                      "v": 212
                    },
                    {
                      "t": "2026-10-16T03:00:00.000Z",
                      "v": 248
                    },
                    {
                      "t": "2026-10-17T03:00:00.000Z",
                      "v": 301
                    },
                    {
                      "t": "2026-10-18T03:00:00.000Z",
                      "v": 276
                    },
                    {
                      "t": "2026-10-19T03:00:00.000Z",
                      "v": 255
                    },
                    {
                      "t": "2026-10-20T03:00:00.000Z",
                      "v": 290
                    },
                    {
                      "t": "2026-10-21T03:00:00.000Z",
                      "v": 261
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/timeseries",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/analytics/breakdown": {
      "get": {
        "operationId": "get-domains-id-analytics-breakdown",
        "tags": [
          "Analytics"
        ],
        "summary": "Breakdown by dimension",
        "description": "Top values of a dimension (pages, sources, countries, UTMs, devices…). `share` is the fraction of the metric's total. On Starter, only path, source and country. Every plan with analytics. On Starter (basic analytics): up to 31 days back, no `compare`, `includeBots` or filters.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "dimension",
            "in": "query",
            "required": false,
            "description": "Dimension (default path).",
            "schema": {
              "type": "string",
              "enum": [
                "path",
                "entry",
                "exit",
                "country",
                "region",
                "city",
                "device",
                "browser",
                "os",
                "source",
                "channel",
                "referrer",
                "utm_source",
                "utm_medium",
                "utm_campaign",
                "lang",
                "bot",
                "status_class",
                "content_kind"
              ]
            }
          },
          {
            "name": "metric",
            "in": "query",
            "required": false,
            "description": "Metric used for ranking (default visitors).",
            "schema": {
              "type": "string",
              "enum": [
                "visitors",
                "pageviews",
                "requests"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 10, max 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "dimension": "source",
                  "metric": "visitors",
                  "items": [
                    {
                      "key": "Instagram",
                      "visitors": 742,
                      "pageviews": 1980,
                      "requests": 17340,
                      "share": 0.4026
                    },
                    {
                      "key": "Google",
                      "visitors": 611,
                      "pageviews": 1795,
                      "requests": 16102,
                      "share": 0.3315
                    },
                    {
                      "key": "Direto",
                      "visitors": 390,
                      "pageviews": 1172,
                      "requests": 12088,
                      "share": 0.2116
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/breakdown",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/analytics/pages": {
      "get": {
        "operationId": "get-domains-id-analytics-pages",
        "tags": [
          "Analytics"
        ],
        "summary": "Pages: top, entry and exit",
        "description": "top includes average time on page (`avgTimeMs`, with the analytics script on); entry carries the bounce rate in `rate`; exit, the exit rate.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "List (default top).",
            "schema": {
              "type": "string",
              "enum": [
                "top",
                "entry",
                "exit"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 20, max 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "kind": "top",
                  "items": [
                    {
                      "path": "/",
                      "visitors": 1502,
                      "pageviews": 2240,
                      "avgTimeMs": 41200,
                      "sessions": 0,
                      "rate": null
                    },
                    {
                      "path": "/agendar",
                      "visitors": 688,
                      "pageviews": 1031,
                      "avgTimeMs": 73800,
                      "sessions": 0,
                      "rate": null
                    },
                    {
                      "path": "/servicos",
                      "visitors": 405,
                      "pageviews": 512,
                      "avgTimeMs": 28500,
                      "sessions": 0,
                      "rate": null
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/pages",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/vitals": {
      "get": {
        "operationId": "get-domains-id-analytics-vitals",
        "tags": [
          "Analytics"
        ],
        "summary": "Web Vitals",
        "description": "p75 of LCP, INP, CLS, FCP and TTFB measured in visitors' browsers (analytics script on), with good/needs improvement/poor counts and the web.dev limits in `thresholds`. Times in ms.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "groupBy",
            "in": "query",
            "required": false,
            "description": "Group by page or device (default path).",
            "schema": {
              "type": "string",
              "enum": [
                "path",
                "device"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 20, max 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "groupBy": "path",
                  "summary": {
                    "lcp": {
                      "p75": 2140,
                      "good": 812,
                      "needsImprovement": 143,
                      "poor": 37
                    },
                    "inp": {
                      "p75": 168,
                      "good": 901,
                      "needsImprovement": 71,
                      "poor": 20
                    },
                    "cls": {
                      "p75": 0.042,
                      "good": 960,
                      "needsImprovement": 25,
                      "poor": 7
                    },
                    "fcp": {
                      "p75": 1390,
                      "good": 870,
                      "needsImprovement": 98,
                      "poor": 24
                    },
                    "ttfb": {
                      "p75": 520,
                      "good": 905,
                      "needsImprovement": 70,
                      "poor": 17
                    },
                    "samples": 992
                  },
                  "thresholds": {
                    "lcp": [
                      2500,
                      4000
                    ],
                    "inp": [
                      200,
                      500
                    ],
                    "cls": [
                      0.1,
                      0.25
                    ],
                    "fcp": [
                      1800,
                      3000
                    ],
                    "ttfb": [
                      800,
                      1800
                    ]
                  },
                  "items": [
                    {
                      "key": "/",
                      "samples": 610,
                      "lcp": 1980,
                      "inp": 152,
                      "cls": 0.031,
                      "fcp": 1310,
                      "ttfb": 490
                    },
                    {
                      "key": "/agendar",
                      "samples": 382,
                      "lcp": 2460,
                      "inp": 194,
                      "cls": 0.068,
                      "fcp": 1520,
                      "ttfb": 575
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/vitals",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/bots": {
      "get": {
        "operationId": "get-domains-id-analytics-bots",
        "tags": [
          "Analytics"
        ],
        "summary": "Bots that visited the domain",
        "description": "Search engines, AIs and other bots, with `verified` when the bot's origin was confirmed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 50, max 200).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "bot": "googlebot",
                      "verified": true,
                      "requests": 1320,
                      "pages": 410,
                      "errors": 6,
                      "avgMs": 142,
                      "lastSeen": "2026-10-22T01:14:09.000Z"
                    },
                    {
                      "bot": "gptbot",
                      "verified": true,
                      "requests": 288,
                      "pages": 97,
                      "errors": 0,
                      "avgMs": 160,
                      "lastSeen": "2026-10-21T22:40:51.000Z"
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/bots",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/bots/pages": {
      "get": {
        "operationId": "get-domains-id-analytics-bots-pages",
        "tags": [
          "Analytics"
        ],
        "summary": "Pages crawled by bots",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "bot",
            "in": "query",
            "required": false,
            "description": "Only this bot (e.g. googlebot). Without it, all bots.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 100, max 1000).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "bot": "googlebot",
                  "items": [
                    {
                      "path": "/",
                      "hits": 96,
                      "lastCrawl": "2026-10-22T01:14:09.000Z",
                      "errors": 0,
                      "avgMs": 118
                    },
                    {
                      "path": "/servicos",
                      "hits": 41,
                      "lastCrawl": "2026-10-21T19:02:33.000Z",
                      "errors": 2,
                      "avgMs": 203
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/bots/pages",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/security": {
      "get": {
        "operationId": "get-domains-id-analytics-security",
        "tags": [
          "Analytics"
        ],
        "summary": "Security: blocks and attacks (TenantGuard)",
        "description": "Requests blocked or flagged by the edge and TenantGuard alerts: timeline, attack types, most active IPs and the 25 latest alerts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 20, max 200).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "summary": {
                    "blocked": 312,
                    "flagged": 41,
                    "attacks": 58,
                    "ips": 17,
                    "bans": 9,
                    "activeBans": 3
                  },
                  "timeline": [
                    {
                      "t": "2026-10-15T03:00:00.000Z",
                      "blocked": 52,
                      "attacks": 11
                    },
                    {
                      "t": "2026-10-16T03:00:00.000Z",
                      "blocked": 38,
                      "attacks": 6
                    }
                  ],
                  "byScenario": [
                    {
                      "scenario": "crowdsecurity/http-probing",
                      "kind": "scan",
                      "message": "Varredura de caminhos",
                      "attacks": 31,
                      "ips": 8,
                      "lastSeen": "2026-10-21T23:55:12.000Z"
                    }
                  ],
                  "topIps": [
                    {
                      "ip": "198.51.100.23",
                      "country": "US",
                      "asName": "DigitalOcean, LLC",
                      "attacks": 14,
                      "lastSeen": "2026-10-21T23:55:12.000Z",
                      "banned": true,
                      "scenarios": [
                        "crowdsecurity/http-probing"
                      ]
                    }
                  ],
                  "recent": [
                    {
                      "id": 90211,
                      "at": "2026-10-21T23:55:12.000Z",
                      "kind": "scan",
                      "scenario": "crowdsecurity/http-probing",
                      "message": "Varredura de caminhos",
                      "ip": "198.51.100.23",
                      "country": "US",
                      "method": "GET",
                      "uri": "/wp-login.php",
                      "decision": "ban"
                    }
                  ],
                  "byAction": [
                    {
                      "action": "block",
                      "requests": 312
                    },
                    {
                      "action": "flag",
                      "requests": 41
                    }
                  ],
                  "byCountry": [
                    {
                      "country": "US",
                      "requests": 188
                    }
                  ],
                  "byPath": [
                    {
                      "path": "/wp-login.php",
                      "requests": 97
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/security",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/errors": {
      "get": {
        "operationId": "get-domains-id-analytics-errors",
        "tags": [
          "Analytics"
        ],
        "summary": "Pages with errors",
        "description": "4xx/5xx responses per page and status.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 50, max 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "path": "/promocao-antiga",
                      "status": 404,
                      "count": 37,
                      "lastSeen": "2026-10-21T20:11:45.000Z"
                    },
                    {
                      "path": "/api/agenda",
                      "status": 502,
                      "count": 4,
                      "lastSeen": "2026-10-20T13:02:10.000Z"
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/errors",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/realtime": {
      "get": {
        "operationId": "get-domains-id-analytics-realtime",
        "tags": [
          "Analytics"
        ],
        "summary": "Real time (last 5 minutes)",
        "description": "Ignores the period and filters. Uncached response.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "visitors5m": 14,
                  "pageviews5m": 31,
                  "pages": [
                    {
                      "path": "/agendar",
                      "visitors": 8
                    },
                    {
                      "path": "/",
                      "visitors": 6
                    }
                  ],
                  "sources": [
                    {
                      "source": "Instagram",
                      "visitors": 9
                    },
                    {
                      "source": "Direto",
                      "visitors": 5
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/realtime",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/tailorkit": {
      "get": {
        "operationId": "get-domains-id-analytics-tailorkit",
        "tags": [
          "Analytics"
        ],
        "summary": "TailorKit rule health",
        "description": "Published rules that didn't find their element on the page (`misses`), per page and version. Available with advanced analytics or with TailorKit.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 200, max 1000).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "path": "/agendar",
                      "version": 7,
                      "ruleId": "hero-title",
                      "misses": 23,
                      "lastSeen": "2026-10-21T17:48:02.000Z"
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/tailorkit",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/experiments/{exp}": {
      "get": {
        "operationId": "get-domains-id-analytics-experiments-exp",
        "tags": [
          "Analytics"
        ],
        "summary": "A/B test results",
        "description": "Visitors and conversions per variant for the goal, with rate, uplift over the control (a), chance to beat it and p-value. `decided` only with a minimum sample (100 visitors and 10 conversions per variant) and chance >= 95%. `details=1` adds per day, device, channel and engagement.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exp",
            "in": "path",
            "required": true,
            "description": "Test id: landing page test (lp-…) or TailorKit test",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "goal",
            "in": "query",
            "required": true,
            "description": "Goal that measures the conversion (e.g. Lead).",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "details",
            "in": "query",
            "required": false,
            "description": "1: includes `details`.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "description": "With details: entry page used for engagement.",
            "schema": {
              "type": "string",
              "maxLength": 300
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "exp": "lp-corte-de-outubro-k3x9",
                  "goal": "Lead",
                  "variants": [
                    {
                      "variant": "a",
                      "visitors": 1204,
                      "conversions": 61,
                      "value": 3050,
                      "rate": 0.0507,
                      "uplift": null,
                      "chanceToBeat": null,
                      "pValue": null
                    },
                    {
                      "variant": "b",
                      "visitors": 1188,
                      "conversions": 89,
                      "value": 4450,
                      "rate": 0.0749,
                      "uplift": 0.4787,
                      "chanceToBeat": 0.993,
                      "pValue": 0.0151
                    }
                  ],
                  "decided": true,
                  "leader": "b",
                  "enoughData": true,
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/experiments/:exp",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/domains/{id}/analytics/campaigns": {
      "get": {
        "operationId": "get-domains-id-analytics-campaigns",
        "tags": [
          "Analytics"
        ],
        "summary": "Campaigns: clicks, goals, channels and costs",
        "description": "Short link clicks, conversions per goal, per channel and per campaign (utm_campaign). From the Landing plan on, `costs: true` and each campaign carries cost in the period, cost per conversion (`cpa`) and return (`roas` = value / cost), using the costs from POST /domains/:id/costs. Every plan with analytics. On Starter (basic analytics): up to 31 days back, no `compare`, `includeBots` or filters.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of rows (default 100, max 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "links": [
                    {
                      "slug": "promo-outubro",
                      "clicks": 412,
                      "visitors": 377,
                      "lastSeen": "2026-10-21T22:03:41.000Z"
                    }
                  ],
                  "goals": [
                    {
                      "name": "Lead",
                      "conversions": 96,
                      "visitors": 91,
                      "value": 4800,
                      "currency": "BRL",
                      "lastSeen": "2026-10-21T21:47:18.000Z"
                    }
                  ],
                  "channels": [
                    {
                      "channel": "social",
                      "sourceName": "Instagram",
                      "conversions": 58,
                      "visitors": 742,
                      "value": 2900
                    },
                    {
                      "channel": "search",
                      "sourceName": "Google",
                      "conversions": 31,
                      "visitors": 611,
                      "value": 1550
                    }
                  ],
                  "campaigns": [
                    {
                      "campaign": "promo-outubro",
                      "utmSource": "instagram",
                      "visitors": 377,
                      "conversions": 44,
                      "value": 2200,
                      "cost": 270.97,
                      "currency": "BRL",
                      "cpa": 6.16,
                      "roas": 8.12
                    }
                  ],
                  "meta": {
                    "from": "2026-10-15T03:00:00.000Z",
                    "to": "2026-10-22T03:00:00.000Z",
                    "tz": "America/Sao_Paulo",
                    "interval": "day",
                    "pageviewSource": "beacon",
                    "tier": "advanced"
                  },
                  "costs": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/campaigns",
        "x-scope": "domains:read"
      }
    },
    "/domains/{id}/analytics/export.csv": {
      "get": {
        "operationId": "get-domains-id-analytics-export-csv",
        "tags": [
          "Analytics"
        ],
        "summary": "Export CSV",
        "description": "With `dimension`: the breakdown (columns <dimension>, visitors, pageviews, requests, share; up to 10,000 rows). Without `dimension`: the time series of `metric` (columns t, <metric> and, with compare=1, previous_t and previous_<metric>).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (ISO 8601 or epoch in s/ms). Default: 7 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End, exclusive (ISO 8601 or epoch). Default: now.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the time buckets (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "description": "Bucket size (default by period length: up to 2 days hour, up to 62 day, up to 190 week, then month).",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ]
            }
          },
          {
            "name": "compare",
            "in": "query",
            "required": false,
            "description": "1: also computes the previous period of the same length (`previous`).",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "includeBots",
            "in": "query",
            "required": false,
            "description": "1: bots count in the visitor metrics.",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "f.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Filter, one parameter per dimension (e.g. f.country=BR&f.device=mobile). Repeatable: up to 20 values of the same dimension = OR; different dimensions = AND. path/entry/exit accept a prefix ending in \"*\" (/blog/*); status_class accepts 2xx, 3xx, 4xx or 5xx. An empty value (f.utm_source=) matches rows without a value. Dimensions: path, entry, exit, country, region, city, device, browser, os, source, channel, referrer, utm_source, utm_medium, utm_campaign, lang, bot, status_class, content_kind.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "nf.<dimensão>",
            "in": "query",
            "required": false,
            "description": "Negated filter: excludes the values (e.g. nf.country=BR). With an empty value, keeps only rows that have a value (nf.utm_campaign= = \"has a campaign\"). Same rules and dimensions as f.<dimension>.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "dimension",
            "in": "query",
            "required": false,
            "description": "Exports the breakdown of this dimension.",
            "schema": {
              "type": "string",
              "enum": [
                "path",
                "entry",
                "exit",
                "country",
                "region",
                "city",
                "device",
                "browser",
                "os",
                "source",
                "channel",
                "referrer",
                "utm_source",
                "utm_medium",
                "utm_campaign",
                "lang",
                "bot",
                "status_class",
                "content_kind"
              ]
            }
          },
          {
            "name": "metric",
            "in": "query",
            "required": false,
            "description": "Metric (default visitors). With dimension, only visitors, pageviews or requests.",
            "schema": {
              "type": "string",
              "enum": [
                "visitors",
                "pageviews",
                "requests",
                "bytes",
                "errors",
                "latency_p95",
                "sessions"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "With dimension: rows (default and max 10,000).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV file (Content-Disposition: attachment)",
            "content": {
              "text/csv": {
                "example": "source,visitors,pageviews,requests,share\r\nInstagram,742,1980,17340,0.4026\r\nGoogle,611,1795,16102,0.3315\r\nDireto,390,1172,12088,0.2116\r\n"
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/analytics/export.csv",
        "x-scope": "domains:read",
        "x-plan": "landing"
      }
    },
    "/analytics/sparklines": {
      "get": {
        "operationId": "get-analytics-sparklines",
        "tags": [
          "Analytics"
        ],
        "summary": "Daily visitors for several domains (7 days)",
        "description": "For domain lists: 7 points (one per day, the last one is today) per domain. Ids from other organizations (or another project, for a restricted key) are ignored. `visitors7d` adds up each day's visitors.",
        "parameters": [
          {
            "name": "domainIds",
            "in": "query",
            "required": true,
            "description": "Comma-separated domain ids (up to 100).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone for the days (default America/Sao_Paulo).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": {
                    "dom_4h7n1q": {
                      "visitors7d": 1843,
                      "points": [
                        212,
                        248,
                        301,
                        276,
                        255,
                        290,
                        261
                      ]
                    },
                    "dom_9k2r5t": {
                      "visitors7d": 402,
                      "points": [
                        51,
                        60,
                        48,
                        66,
                        59,
                        63,
                        55
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/analytics/sparklines",
        "x-scope": "domains:read"
      }
    },
    "/projects/{id}/portal": {
      "get": {
        "operationId": "get-projects-id-portal",
        "tags": [
          "Customer portal"
        ],
        "summary": "Get the portal settings",
        "description": "What the end customer can do in the portal. Without settings, returns the default (off).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "enabled": true,
                  "domains": true,
                  "brand": true,
                  "analytics": true,
                  "maxDomains": 1,
                  "allowExtraCharge": false,
                  "templateDomainId": "dom_4h7n1q",
                  "exposeTenant": false,
                  "supportEmail": "suporte@agendafacil.com",
                  "welcome": "Conecte o domínio da sua barbearia e ajuste a marca."
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:id/portal",
        "x-scope": "projects:read"
      },
      "put": {
        "operationId": "put-projects-id-portal",
        "tags": [
          "Customer portal"
        ],
        "summary": "Configure the portal",
        "description": "Only the fields you send change. Returns the full settings. The template domain must belong to this project (`invalid_template`).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "description": "Turns the portal on (required to create links).",
                    "type": "boolean"
                  },
                  "domains": {
                    "description": "The customer can connect their own domain.",
                    "type": "boolean"
                  },
                  "brand": {
                    "description": "The customer can adjust their domain's logo, colors and favicon (published right away).",
                    "type": "boolean"
                  },
                  "analytics": {
                    "description": "The customer sees their own domain's analytics.",
                    "type": "boolean"
                  },
                  "maxDomains": {
                    "description": "Domains per customer (default 1).",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  },
                  "allowExtraCharge": {
                    "description": "Lets the customer go over the plan's domain limit (the extra-domain charge is yours).",
                    "type": "boolean"
                  },
                  "templateDomainId": {
                    "description": "Template domain of this project: its published TailorKit is copied to domains connected through the portal.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "exposeTenant": {
                    "description": "Domains connected through the portal expose the customer's data as window.TENANCI.",
                    "type": "boolean"
                  },
                  "supportEmail": {
                    "description": "Support email shown in the portal.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "welcome": {
                    "description": "Welcome message at the top of the portal.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "enabled": true,
                "maxDomains": 1,
                "templateDomainId": "dom_4h7n1q",
                "supportEmail": "suporte@agendafacil.com",
                "welcome": "Conecte o domínio da sua barbearia e ajuste a marca."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "enabled": true,
                  "domains": true,
                  "brand": true,
                  "analytics": true,
                  "maxDomains": 1,
                  "allowExtraCharge": false,
                  "templateDomainId": "dom_4h7n1q",
                  "exposeTenant": false,
                  "supportEmail": "suporte@agendafacil.com",
                  "welcome": "Conecte o domínio da sua barbearia e ajuste a marca."
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/projects/:id/portal",
        "x-scope": "projects:write",
        "x-plan": "growth"
      }
    },
    "/projects/{id}/portal/sessions": {
      "post": {
        "operationId": "post-projects-id-portal-sessions",
        "tags": [
          "Customer portal"
        ],
        "summary": "Create a portal link for a customer",
        "description": "Like Stripe's customer portal: call it from your backend and send the `url` to the customer (or redirect). The secret goes in the fragment (#), out of logs and the Referer, and is only shown in this response. The link lasts 60 min by default (up to 24 h) and the portal must be on (otherwise 400 `portal_disabled`). Domains the customer connects join the project with the `tenantId` already set.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tenantId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Customer id in your system."
                  },
                  "tenantData": {
                    "description": "Customer data (the `name` shows in the portal), sent to the origin on connected domains.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number",
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "returnUrl": {
                    "description": "https address for the back-to-your-app button.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "description": "Customer email (for the record).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ttlMinutes": {
                    "description": "Link lifetime in minutes (default 60, up to 1440).",
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 1440
                  }
                },
                "required": [
                  "tenantId"
                ]
              },
              "example": {
                "tenantId": "barbearia-123",
                "tenantData": {
                  "name": "Barbearia do Zé",
                  "plan": "pro"
                },
                "returnUrl": "https://app.agendafacil.com/configuracoes",
                "ttlMinutes": 60
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "pss_01jb2x7k9m",
                  "url": "https://app.tenanci.com/portal#pss_01jb2x7k9m.Yk3pQ9vT2mXc8LwR5nB7aZ1dF4gH6jK0",
                  "expiresAt": "2026-10-14T13:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/portal/sessions",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/projects/{id}/status-page": {
      "get": {
        "operationId": "get-projects-id-status-page",
        "tags": [
          "Status & reports"
        ],
        "summary": "Get the status page and incidents",
        "description": "The page lives at `/__tenanci/status` on every domain of the project, with your brand and nothing from Tenanci: availability for the last 90 days, current status and incidents. `incidents` holds the 50 most recent.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "settings": {
                    "enabled": true,
                    "title": "Agenda Fácil",
                    "description": "Situação do sistema de agendamento",
                    "logoUrl": "https://assets.tenanci.com/org_5t1v/logo.png",
                    "color": "#1f2937"
                  },
                  "incidents": [
                    {
                      "id": "inc_6w2r8t",
                      "title": "Lentidão no agendamento",
                      "impact": "minor",
                      "status": "investigating",
                      "updates": [
                        {
                          "at": "2026-10-14T18:02:00.000Z",
                          "status": "investigating",
                          "message": "Estamos investigando a lentidão ao confirmar horários."
                        }
                      ],
                      "startedAt": "2026-10-14T18:00:00.000Z",
                      "resolvedAt": null
                    }
                  ],
                  "path": "/__tenanci/status"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:id/status-page",
        "x-scope": "projects:read"
      },
      "put": {
        "operationId": "put-projects-id-status-page",
        "tags": [
          "Status & reports"
        ],
        "summary": "Configure the status page",
        "description": "Title, logo and color are also the brand of the customer report and portal. Only the fields you send change.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "description": "Publishes the page.",
                    "type": "boolean"
                  },
                  "title": {
                    "description": "Title (default: project name).",
                    "type": "string",
                    "maxLength": 80
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "logoUrl": {
                    "description": "https logo URL (upload it with POST /assets).",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2048
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "color": {
                    "description": "Brand color as #rrggbb.",
                    "type": "string",
                    "maxLength": 7
                  }
                }
              },
              "example": {
                "enabled": true,
                "title": "Agenda Fácil",
                "description": "Situação do sistema de agendamento",
                "color": "#1f2937"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "settings": {
                    "enabled": true,
                    "title": "Agenda Fácil",
                    "description": "Situação do sistema de agendamento",
                    "logoUrl": "https://assets.tenanci.com/org_5t1v/logo.png",
                    "color": "#1f2937"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/projects/:id/status-page",
        "x-scope": "projects:write"
      }
    },
    "/projects/{id}/incidents": {
      "post": {
        "operationId": "post-projects-id-incidents",
        "tags": [
          "Status & reports"
        ],
        "summary": "Publish an incident",
        "description": "Shows on the status page. Without `status`, it starts as investigating (or scheduled when `impact` is maintenance).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Short title."
                  },
                  "impact": {
                    "type": "string",
                    "enum": [
                      "minor",
                      "major",
                      "maintenance"
                    ],
                    "description": "minor (partial), major (outage) or maintenance (planned)."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "investigating",
                      "identified",
                      "monitoring",
                      "resolved",
                      "scheduled"
                    ],
                    "description": "investigating, identified, monitoring, resolved or scheduled (planned maintenance)."
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "First update."
                  },
                  "startedAt": {
                    "description": "Start (ISO 8601; default now).",
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "required": [
                  "title",
                  "impact",
                  "message"
                ]
              },
              "example": {
                "title": "Lentidão no agendamento",
                "impact": "minor",
                "message": "Estamos investigando a lentidão ao confirmar horários."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "inc_6w2r8t",
                  "title": "Lentidão no agendamento",
                  "impact": "minor",
                  "status": "investigating",
                  "updates": [
                    {
                      "at": "2026-10-14T18:02:00.000Z",
                      "status": "investigating",
                      "message": "Estamos investigando a lentidão ao confirmar horários."
                    }
                  ],
                  "startedAt": "2026-10-14T18:00:00.000Z",
                  "resolvedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/incidents",
        "x-scope": "projects:write"
      }
    },
    "/projects/{id}/incidents/{incidentId}": {
      "post": {
        "operationId": "post-projects-id-incidents-incidentid",
        "tags": [
          "Status & reports"
        ],
        "summary": "Post an incident update",
        "description": "Appends an update (keeps the last 50). `resolved` closes the incident.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "incidentId",
            "in": "path",
            "required": true,
            "description": "Incident id (inc_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "investigating",
                      "identified",
                      "monitoring",
                      "resolved",
                      "scheduled"
                    ],
                    "description": "investigating, identified, monitoring, resolved or scheduled (planned maintenance)."
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "required": [
                  "status",
                  "message"
                ]
              },
              "example": {
                "status": "resolved",
                "message": "Normalizado. Os agendamentos voltaram ao tempo de sempre."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "inc_6w2r8t",
                  "title": "Lentidão no agendamento",
                  "impact": "minor",
                  "status": "resolved",
                  "updates": [
                    {
                      "at": "2026-10-14T18:02:00.000Z",
                      "status": "investigating",
                      "message": "Estamos investigando a lentidão ao confirmar horários."
                    },
                    {
                      "at": "2026-10-14T18:40:00.000Z",
                      "status": "resolved",
                      "message": "Normalizado. Os agendamentos voltaram ao tempo de sempre."
                    }
                  ],
                  "startedAt": "2026-10-14T18:00:00.000Z",
                  "resolvedAt": "2026-10-14T18:40:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/incidents/:incidentId",
        "x-scope": "projects:write"
      },
      "delete": {
        "operationId": "delete-projects-id-incidents-incidentid",
        "tags": [
          "Status & reports"
        ],
        "summary": "Delete an incident",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "incidentId",
            "in": "path",
            "required": true,
            "description": "Incident id (inc_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/projects/:id/incidents/:incidentId",
        "x-scope": "projects:write"
      }
    },
    "/domains/{id}/report": {
      "get": {
        "operationId": "get-domains-id-report",
        "tags": [
          "Status & reports"
        ],
        "summary": "Get the customer report",
        "description": "Private link on the customer's domain (`/__tenanci/report/<token>`) with the last 30 days: visitors, pages, sources, devices and countries, with the status page's brand. `url: null` = off.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "url": "https://barbeariadoze.com.br/__tenanci/report/Vb8mK2qX7nR4tW9zL3pC5a",
                  "email": "ze@barbeariadoze.com.br",
                  "monthly": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/report",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-report",
        "tags": [
          "Status & reports"
        ],
        "summary": "Configure the customer report",
        "description": "The first call creates the link. `monthly` sends the summary on the 1st of every month to `email` (through the white-label sender, if verified).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "description": "Customer email for the monthly send.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "monthly": {
                    "description": "Send the summary on the 1st of each month (requires email).",
                    "type": "boolean"
                  },
                  "regenerate": {
                    "description": "Replace the link (the old one stops working).",
                    "type": "boolean"
                  },
                  "enabled": {
                    "description": "false turns the link off.",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "email": "ze@barbeariadoze.com.br",
                "monthly": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "url": "https://barbeariadoze.com.br/__tenanci/report/Vb8mK2qX7nR4tW9zL3pC5a",
                  "email": "ze@barbeariadoze.com.br",
                  "monthly": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/report",
        "x-scope": "domains:write"
      }
    },
    "/projects/{id}/sender": {
      "get": {
        "operationId": "get-projects-id-sender",
        "tags": [
          "Emails"
        ],
        "summary": "Get the sender of the project",
        "description": "`sender: null` when no sending domain is set.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "sender": {
                    "id": "snd_2p7k5m",
                    "domain": "agendafacil.com",
                    "from": "Agenda Fácil <contato@agendafacil.com>",
                    "fromName": "Agenda Fácil",
                    "fromLocal": "contato",
                    "replyTo": null,
                    "status": "verified",
                    "records": [
                      {
                        "name": "agendafacil.com",
                        "type": "TXT",
                        "value": "brevo-code:5f1e2d3c4b5a69788796a5b4c3d2e1f0",
                        "ok": true
                      },
                      {
                        "name": "mail._domainkey.agendafacil.com",
                        "type": "TXT",
                        "value": "k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC…",
                        "ok": true
                      },
                      {
                        "name": "_dmarc.agendafacil.com",
                        "type": "TXT",
                        "value": "v=DMARC1; p=none; rua=mailto:rua@dmarc.brevo.com",
                        "ok": true
                      }
                    ],
                    "lastCheckedAt": "2026-10-14T13:00:00.000Z",
                    "verifiedAt": "2026-10-14T13:00:00.000Z"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:id/sender",
        "x-scope": "projects:read"
      },
      "put": {
        "operationId": "put-projects-id-sender",
        "tags": [
          "Emails"
        ],
        "summary": "Set the sender of the project",
        "description": "Registers the sending domain of the project (your app; used by domains without their own sender) with Brevo and returns in `records` the TXT records (code, DKIM and DMARC) to create on DNS. Then call verify. Changing only name, address or reply-to doesn't require verifying again; changing the domain does.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "maxLength": 253,
                    "description": "Sending domain (the customer's or your app's)."
                  },
                  "fromName": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "Sender name."
                  },
                  "fromLocal": {
                    "description": "What comes before the @ (default contato).",
                    "type": "string",
                    "maxLength": 64
                  },
                  "replyTo": {
                    "description": "Reply-to address.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 254
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "domain",
                  "fromName"
                ]
              },
              "example": {
                "domain": "agendafacil.com",
                "fromName": "Agenda Fácil"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "snd_2p7k5m",
                  "domain": "agendafacil.com",
                  "from": "Agenda Fácil <contato@agendafacil.com>",
                  "fromName": "Agenda Fácil",
                  "fromLocal": "contato",
                  "replyTo": null,
                  "status": "pending",
                  "records": [
                    {
                      "name": "agendafacil.com",
                      "type": "TXT",
                      "value": "brevo-code:5f1e2d3c4b5a69788796a5b4c3d2e1f0",
                      "ok": false
                    },
                    {
                      "name": "mail._domainkey.agendafacil.com",
                      "type": "TXT",
                      "value": "k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC…",
                      "ok": false
                    },
                    {
                      "name": "_dmarc.agendafacil.com",
                      "type": "TXT",
                      "value": "v=DMARC1; p=none; rua=mailto:rua@dmarc.brevo.com",
                      "ok": false
                    }
                  ],
                  "lastCheckedAt": null,
                  "verifiedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/projects/:id/sender",
        "x-scope": "projects:write",
        "x-plan": "growth"
      },
      "delete": {
        "operationId": "delete-projects-id-sender",
        "tags": [
          "Emails"
        ],
        "summary": "Remove the sender of the project",
        "description": "Domains without their own sender fall back to the platform's default sender.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/projects/:id/sender",
        "x-scope": "projects:write"
      }
    },
    "/projects/{id}/sender/verify": {
      "post": {
        "operationId": "post-projects-id-sender-verify",
        "tags": [
          "Emails"
        ],
        "summary": "Verify the sender of the project",
        "description": "Asks Brevo to authenticate and updates `status` (pending, verified or failed) and each record's `ok`. Tenanci also re-checks pending senders on its own for up to 3 days.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "snd_2p7k5m",
                  "domain": "agendafacil.com",
                  "from": "Agenda Fácil <contato@agendafacil.com>",
                  "fromName": "Agenda Fácil",
                  "fromLocal": "contato",
                  "replyTo": null,
                  "status": "verified",
                  "records": [
                    {
                      "name": "agendafacil.com",
                      "type": "TXT",
                      "value": "brevo-code:5f1e2d3c4b5a69788796a5b4c3d2e1f0",
                      "ok": true
                    },
                    {
                      "name": "mail._domainkey.agendafacil.com",
                      "type": "TXT",
                      "value": "k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC…",
                      "ok": true
                    },
                    {
                      "name": "_dmarc.agendafacil.com",
                      "type": "TXT",
                      "value": "v=DMARC1; p=none; rua=mailto:rua@dmarc.brevo.com",
                      "ok": true
                    }
                  ],
                  "lastCheckedAt": "2026-10-14T13:00:00.000Z",
                  "verifiedAt": "2026-10-14T13:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:id/sender/verify",
        "x-scope": "projects:write"
      }
    },
    "/domains/{id}/sender": {
      "get": {
        "operationId": "get-domains-id-sender",
        "tags": [
          "Emails"
        ],
        "summary": "Get the sender of the domain",
        "description": "`sender: null` when no sending domain is set.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "sender": {
                    "id": "snd_9c4v2h",
                    "domain": "barbeariadoze.com.br",
                    "from": "Barbearia do Zé <contato@barbeariadoze.com.br>",
                    "fromName": "Barbearia do Zé",
                    "fromLocal": "contato",
                    "replyTo": "ze@barbeariadoze.com.br",
                    "status": "verified",
                    "records": [
                      {
                        "name": "barbeariadoze.com.br",
                        "type": "TXT",
                        "value": "brevo-code:5f1e2d3c4b5a69788796a5b4c3d2e1f0",
                        "ok": true
                      },
                      {
                        "name": "mail._domainkey.barbeariadoze.com.br",
                        "type": "TXT",
                        "value": "k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC…",
                        "ok": true
                      },
                      {
                        "name": "_dmarc.barbeariadoze.com.br",
                        "type": "TXT",
                        "value": "v=DMARC1; p=none; rua=mailto:rua@dmarc.brevo.com",
                        "ok": true
                      }
                    ],
                    "lastCheckedAt": "2026-10-14T13:00:00.000Z",
                    "verifiedAt": "2026-10-14T13:00:00.000Z"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/sender",
        "x-scope": "domains:read"
      },
      "put": {
        "operationId": "put-domains-id-sender",
        "tags": [
          "Emails"
        ],
        "summary": "Set the sender of the domain",
        "description": "Registers the sending domain of the end customer (used for this domain's emails) with Brevo and returns in `records` the TXT records (code, DKIM and DMARC) to create on DNS. Then call verify. Changing only name, address or reply-to doesn't require verifying again; changing the domain does.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "maxLength": 253,
                    "description": "Sending domain (the customer's or your app's)."
                  },
                  "fromName": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "Sender name."
                  },
                  "fromLocal": {
                    "description": "What comes before the @ (default contato).",
                    "type": "string",
                    "maxLength": 64
                  },
                  "replyTo": {
                    "description": "Reply-to address.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 254
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "domain",
                  "fromName"
                ]
              },
              "example": {
                "domain": "barbeariadoze.com.br",
                "fromName": "Barbearia do Zé",
                "fromLocal": "contato",
                "replyTo": "ze@barbeariadoze.com.br"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "snd_9c4v2h",
                  "domain": "barbeariadoze.com.br",
                  "from": "Barbearia do Zé <contato@barbeariadoze.com.br>",
                  "fromName": "Barbearia do Zé",
                  "fromLocal": "contato",
                  "replyTo": "ze@barbeariadoze.com.br",
                  "status": "pending",
                  "records": [
                    {
                      "name": "barbeariadoze.com.br",
                      "type": "TXT",
                      "value": "brevo-code:5f1e2d3c4b5a69788796a5b4c3d2e1f0",
                      "ok": false
                    },
                    {
                      "name": "mail._domainkey.barbeariadoze.com.br",
                      "type": "TXT",
                      "value": "k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC…",
                      "ok": false
                    },
                    {
                      "name": "_dmarc.barbeariadoze.com.br",
                      "type": "TXT",
                      "value": "v=DMARC1; p=none; rua=mailto:rua@dmarc.brevo.com",
                      "ok": false
                    }
                  ],
                  "lastCheckedAt": null,
                  "verifiedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PUT/domains/:id/sender",
        "x-scope": "domains:write",
        "x-plan": "growth"
      },
      "delete": {
        "operationId": "delete-domains-id-sender",
        "tags": [
          "Emails"
        ],
        "summary": "Remove the sender of the domain",
        "description": "The domain's emails go out through the project's sender (or the default).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/domains/:id/sender",
        "x-scope": "domains:write"
      }
    },
    "/domains/{id}/sender/verify": {
      "post": {
        "operationId": "post-domains-id-sender-verify",
        "tags": [
          "Emails"
        ],
        "summary": "Verify the sender of the domain",
        "description": "Asks Brevo to authenticate and updates `status` (pending, verified or failed) and each record's `ok`. Tenanci also re-checks pending senders on its own for up to 3 days.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "snd_9c4v2h",
                  "domain": "barbeariadoze.com.br",
                  "from": "Barbearia do Zé <contato@barbeariadoze.com.br>",
                  "fromName": "Barbearia do Zé",
                  "fromLocal": "contato",
                  "replyTo": "ze@barbeariadoze.com.br",
                  "status": "verified",
                  "records": [
                    {
                      "name": "barbeariadoze.com.br",
                      "type": "TXT",
                      "value": "brevo-code:5f1e2d3c4b5a69788796a5b4c3d2e1f0",
                      "ok": true
                    },
                    {
                      "name": "mail._domainkey.barbeariadoze.com.br",
                      "type": "TXT",
                      "value": "k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC…",
                      "ok": true
                    },
                    {
                      "name": "_dmarc.barbeariadoze.com.br",
                      "type": "TXT",
                      "value": "v=DMARC1; p=none; rua=mailto:rua@dmarc.brevo.com",
                      "ok": true
                    }
                  ],
                  "lastCheckedAt": "2026-10-14T13:00:00.000Z",
                  "verifiedAt": "2026-10-14T13:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/domains/:id/sender/verify",
        "x-scope": "domains:write"
      }
    },
    "/emails": {
      "post": {
        "operationId": "post-emails",
        "tags": [
          "Emails"
        ],
        "summary": "Send an email from the customer's domain",
        "description": "Goes out through the domain's verified sender (or the project's); with none, 400 `sender_not_verified`. One email per recipient (nobody sees the others), up to 50. Needs `text` or `html` (without `text`, it's generated from the html). There's a per-organization limit per 24 h (429 `email_limit`). Each recipient comes back as `sent` or `failed`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domainId": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Customer domain (dom_…) whose sender is used."
                  },
                  "to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 254
                      },
                      {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 254
                        }
                      }
                    ],
                    "description": "One email or a list (up to 50)."
                  },
                  "subject": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 100000
                  },
                  "html": {
                    "type": "string",
                    "maxLength": 200000
                  },
                  "replyTo": {
                    "description": "Default: the sender's.",
                    "type": "string",
                    "maxLength": 254
                  },
                  "fromLocal": {
                    "description": "Overrides what comes before the @ for this send only (e.g. bookings).",
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "domainId",
                  "to",
                  "subject"
                ]
              },
              "example": {
                "domainId": "dom_4h7n1q",
                "to": "cliente@gmail.com",
                "subject": "Seu horário está confirmado",
                "html": "<p>Olá! Seu corte está marcado para sexta, às 15h.</p>",
                "fromLocal": "agendamentos"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "from": "Barbearia do Zé <agendamentos@barbeariadoze.com.br>",
                  "results": [
                    {
                      "to": "cliente@gmail.com",
                      "status": "sent"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/emails",
        "x-scope": "domains:write",
        "x-plan": "growth"
      }
    },
    "/domains/{id}/emails": {
      "get": {
        "operationId": "get-domains-id-emails",
        "tags": [
          "Emails"
        ],
        "summary": "Recent sends of the domain",
        "description": "The 50 most recent sends through the email API.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Resource id (prj_…, dom_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "eml_7t3k9w",
                      "to": "cliente@gmail.com",
                      "subject": "Seu horário está confirmado",
                      "sender": "agendamentos@barbeariadoze.com.br",
                      "status": "sent",
                      "error": null,
                      "createdAt": "2026-10-14T14:20:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/domains/:id/emails",
        "x-scope": "domains:read"
      }
    },
    "/projects/{p}/authmesh": {
      "get": {
        "operationId": "get-projects-p-authmesh",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "List AuthMesh services",
        "description": "The secret is never returned (`hasCredential` tells whether there is one). `activationProblems` lists what's missing before the service can be turned on.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "id_01JA3M7Q2K8W4N6P9R1T5V3X0Z",
                      "orgId": "org_5t1v",
                      "projectId": "prj_8f3k2m",
                      "slug": "asaas",
                      "name": "Cobranças (Asaas)",
                      "upstreamBaseUrl": "https://api.asaas.com/v3",
                      "enabled": true,
                      "credentialKind": "header",
                      "credentialName": "access_token",
                      "allowedMethods": [
                        "GET",
                        "POST"
                      ],
                      "allowedPaths": [
                        "/payments/*",
                        "/customers"
                      ],
                      "callerAuth": "jwt",
                      "jwksUrl": "https://app.agendafacil.com/.well-known/jwks.json",
                      "jwtIssuer": "https://app.agendafacil.com",
                      "jwtAudience": "agendafacil",
                      "introspectionUrl": null,
                      "allowedOrigins": [
                        "https://barbeariadoze.com.br"
                      ],
                      "rateLimitPerMin": 60,
                      "maxBodyKb": 256,
                      "legacyBubbleId": null,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "updatedAt": "2026-10-14T12:20:00.000Z",
                      "deletedAt": null,
                      "hasCredential": true,
                      "activationProblems": []
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:p/authmesh",
        "x-scope": "projects:read",
        "x-plan": "scale"
      },
      "post": {
        "operationId": "post-projects-p-authmesh",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Create an AuthMesh service",
        "description": "The API secret stays at Tenanci and the edge injects it into browser calls to https://<domain>/__tenanci/mesh/<slug>/<path> → <upstream>/<path>. The service starts off: turn it on with PATCH after setting the credential, allowed paths and caller authentication. Duplicate slug: 409 `slug_taken`.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Identifier in the /__tenanci/mesh/<slug>/… address (2–40 characters a-z, 0-9, -). Unique within the project."
                  },
                  "upstreamBaseUrl": {
                    "type": "string",
                    "description": "https URL of the target API (internal hosts and IPs are rejected)."
                  },
                  "name": {
                    "description": "A name you'll recognize (up to 80 characters).",
                    "type": "string"
                  },
                  "credential": {
                    "description": "Credential the edge injects into every upstream call.",
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "header",
                          "bearer",
                          "basic",
                          "query"
                        ],
                        "description": "How the credential is sent upstream: custom header, Authorization: Bearer, Basic or query parameter."
                      },
                      "name": {
                        "description": "Header or parameter name (required for header and query).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "secret": {
                        "type": "string",
                        "description": "The API secret. It's stored encrypted at Tenanci and never returned."
                      }
                    },
                    "required": [
                      "kind",
                      "secret"
                    ]
                  },
                  "allowedMethods": {
                    "description": "Allowed methods: GET, POST, PUT, PATCH, DELETE (default GET only).",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "allowedPaths": {
                    "description": "Allowed upstream paths (start with /). \"/x\" matches /x and everything below; \"/x/*\" only what's below. Nothing is allowed by default.",
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "callerAuth": {
                    "description": "How the caller proves who they are: user JWT (default), session introspection on your backend, or public.",
                    "type": "string",
                    "enum": [
                      "public",
                      "jwt",
                      "session_introspection"
                    ]
                  },
                  "jwksUrl": {
                    "description": "https URL of the JWKS that validates the JWT (callerAuth jwt).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwtIssuer": {
                    "description": "Expected issuer (iss) in the JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwtAudience": {
                    "description": "Expected audience (aud) in the JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "introspectionUrl": {
                    "description": "https URL on your backend that confirms the session (callerAuth session_introspection).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "allowedOrigins": {
                    "description": "https origins allowed to call the service from the browser.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "rateLimitPerMin": {
                    "description": "Calls per minute (1 to 100,000; default 60).",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "maxBodyKb": {
                    "description": "Max body size in KB (1 to 10,240; default 256).",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "slug",
                  "upstreamBaseUrl"
                ]
              },
              "example": {
                "slug": "asaas",
                "name": "Cobranças (Asaas)",
                "upstreamBaseUrl": "https://api.asaas.com/v3",
                "credential": {
                  "kind": "header",
                  "name": "access_token",
                  "secret": "$aact_prod_000Mz…"
                },
                "allowedMethods": [
                  "GET",
                  "POST"
                ],
                "allowedPaths": [
                  "/payments/*",
                  "/customers"
                ],
                "callerAuth": "jwt",
                "jwksUrl": "https://app.agendafacil.com/.well-known/jwks.json",
                "jwtIssuer": "https://app.agendafacil.com",
                "allowedOrigins": [
                  "https://barbeariadoze.com.br"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "id_01JA3M7Q2K8W4N6P9R1T5V3X0Z",
                  "orgId": "org_5t1v",
                  "projectId": "prj_8f3k2m",
                  "slug": "asaas",
                  "name": "Cobranças (Asaas)",
                  "upstreamBaseUrl": "https://api.asaas.com/v3",
                  "enabled": false,
                  "credentialKind": "header",
                  "credentialName": "access_token",
                  "allowedMethods": [
                    "GET",
                    "POST"
                  ],
                  "allowedPaths": [
                    "/payments/*",
                    "/customers"
                  ],
                  "callerAuth": "jwt",
                  "jwksUrl": "https://app.agendafacil.com/.well-known/jwks.json",
                  "jwtIssuer": "https://app.agendafacil.com",
                  "jwtAudience": null,
                  "introspectionUrl": null,
                  "allowedOrigins": [
                    "https://barbeariadoze.com.br"
                  ],
                  "rateLimitPerMin": 60,
                  "maxBodyKb": 256,
                  "legacyBubbleId": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z",
                  "deletedAt": null,
                  "hasCredential": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:p/authmesh",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/authmesh/{id}": {
      "patch": {
        "operationId": "patch-projects-p-authmesh-id",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Update an AuthMesh service",
        "description": "To turn it on (`enabled: true`) the service needs a credential, at least one allowed path and caller authentication configured; otherwise 422 `authmesh_policy_required` with what's missing in `details`. A public service (`callerAuth: public`) requires `acknowledgePublic: true`.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "AuthMesh service id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Identifier in the /__tenanci/mesh/<slug>/… address (2–40 characters a-z, 0-9, -). Unique within the project."
                  },
                  "upstreamBaseUrl": {
                    "type": "string",
                    "description": "https URL of the target API (internal hosts and IPs are rejected)."
                  },
                  "name": {
                    "description": "A name you'll recognize (up to 80 characters).",
                    "type": "string"
                  },
                  "credential": {
                    "description": "Credential the edge injects into every upstream call.",
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "header",
                          "bearer",
                          "basic",
                          "query"
                        ],
                        "description": "How the credential is sent upstream: custom header, Authorization: Bearer, Basic or query parameter."
                      },
                      "name": {
                        "description": "Header or parameter name (required for header and query).",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "secret": {
                        "type": "string",
                        "description": "The API secret. It's stored encrypted at Tenanci and never returned."
                      }
                    },
                    "required": [
                      "kind",
                      "secret"
                    ]
                  },
                  "allowedMethods": {
                    "description": "Allowed methods: GET, POST, PUT, PATCH, DELETE (default GET only).",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "allowedPaths": {
                    "description": "Allowed upstream paths (start with /). \"/x\" matches /x and everything below; \"/x/*\" only what's below. Nothing is allowed by default.",
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "callerAuth": {
                    "description": "How the caller proves who they are: user JWT (default), session introspection on your backend, or public.",
                    "type": "string",
                    "enum": [
                      "public",
                      "jwt",
                      "session_introspection"
                    ]
                  },
                  "jwksUrl": {
                    "description": "https URL of the JWKS that validates the JWT (callerAuth jwt).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwtIssuer": {
                    "description": "Expected issuer (iss) in the JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwtAudience": {
                    "description": "Expected audience (aud) in the JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "introspectionUrl": {
                    "description": "https URL on your backend that confirms the session (callerAuth session_introspection).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "allowedOrigins": {
                    "description": "https origins allowed to call the service from the browser.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "rateLimitPerMin": {
                    "description": "Calls per minute (1 to 100,000; default 60).",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "maxBodyKb": {
                    "description": "Max body size in KB (1 to 10,240; default 256).",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "enabled": {
                    "description": "Turns the service on or off at the edge.",
                    "type": "boolean"
                  },
                  "acknowledgePublic": {
                    "description": "Confirms any visitor will be able to use the credential within the allowed paths (required to turn on with callerAuth public).",
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "enabled": true,
                "jwtAudience": "agendafacil"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "id_01JA3M7Q2K8W4N6P9R1T5V3X0Z",
                  "orgId": "org_5t1v",
                  "projectId": "prj_8f3k2m",
                  "slug": "asaas",
                  "name": "Cobranças (Asaas)",
                  "upstreamBaseUrl": "https://api.asaas.com/v3",
                  "enabled": true,
                  "credentialKind": "header",
                  "credentialName": "access_token",
                  "allowedMethods": [
                    "GET",
                    "POST"
                  ],
                  "allowedPaths": [
                    "/payments/*",
                    "/customers"
                  ],
                  "callerAuth": "jwt",
                  "jwksUrl": "https://app.agendafacil.com/.well-known/jwks.json",
                  "jwtIssuer": "https://app.agendafacil.com",
                  "jwtAudience": "agendafacil",
                  "introspectionUrl": null,
                  "allowedOrigins": [
                    "https://barbeariadoze.com.br"
                  ],
                  "rateLimitPerMin": 60,
                  "maxBodyKb": 256,
                  "legacyBubbleId": null,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:20:00.000Z",
                  "deletedAt": null,
                  "hasCredential": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/projects/:p/authmesh/:id",
        "x-scope": "projects:write",
        "x-plan": "scale"
      },
      "delete": {
        "operationId": "delete-projects-p-authmesh-id",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Delete an AuthMesh service",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "AuthMesh service id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/projects/:p/authmesh/:id",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway": {
      "get": {
        "operationId": "get-projects-p-gateway",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "List gateway APIs",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
                      "orgId": "org_5t1v",
                      "projectId": "prj_8f3k2m",
                      "name": "API de agendamentos",
                      "pathPrefix": "/api",
                      "enabled": true,
                      "apiKeyHeader": "x-api-key",
                      "allowApiKeys": true,
                      "jwtIssuer": null,
                      "jwtAudience": null,
                      "jwksUrl": null,
                      "rateLimitPerMin": 600,
                      "createdAt": "2026-10-14T12:00:00.000Z",
                      "updatedAt": "2026-10-14T12:00:00.000Z",
                      "deletedAt": null
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:p/gateway",
        "x-scope": "projects:read",
        "x-plan": "scale"
      },
      "post": {
        "operationId": "post-projects-p-gateway",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Create a gateway API",
        "description": "Tenanci authenticates whoever calls your API (a Tenanci-issued key or a JWT), applies scopes and limits and forwards to your backend. `signingSecret` is only shown in this response: store it in your backend. Your backend checks `X-Tenanci-Signature` (HMAC-SHA256 with this secret) on every call the gateway forwards, to reject anything that didn't go through it. Duplicate prefix: 409 `prefix_taken`.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pathPrefix": {
                    "type": "string",
                    "description": "Path prefix on the project's domains where the API answers (e.g. /api). Unique within the project; /__tenanci, /__external__ and /.well-known are reserved."
                  },
                  "name": {
                    "description": "A name you'll recognize (up to 80 characters).",
                    "type": "string"
                  },
                  "enabled": {
                    "description": "Turns the API on at the edge. Requires API keys or a JWKS.",
                    "type": "boolean"
                  },
                  "apiKeyHeader": {
                    "description": "Header the consumer sends the key in (default x-api-key).",
                    "type": "string"
                  },
                  "allowApiKeys": {
                    "description": "Accept keys issued by Tenanci (default true).",
                    "type": "boolean"
                  },
                  "jwtIssuer": {
                    "description": "Expected issuer (iss) when the consumer uses a JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwtAudience": {
                    "description": "Expected audience (aud) in the JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwksUrl": {
                    "description": "https URL of your identity provider's JWKS (accepts JWTs besides keys).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rateLimitPerMin": {
                    "description": "Calls per minute per consumer (1 to 1,000,000; default 600).",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "pathPrefix"
                ]
              },
              "example": {
                "name": "API de agendamentos",
                "pathPrefix": "/api",
                "allowApiKeys": true,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
                  "orgId": "org_5t1v",
                  "projectId": "prj_8f3k2m",
                  "name": "API de agendamentos",
                  "pathPrefix": "/api",
                  "enabled": true,
                  "apiKeyHeader": "x-api-key",
                  "allowApiKeys": true,
                  "jwtIssuer": null,
                  "jwtAudience": null,
                  "jwksUrl": null,
                  "rateLimitPerMin": 600,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-14T12:00:00.000Z",
                  "deletedAt": null,
                  "signingSecret": "EXEMPLO-segredo-de-assinatura-mostrado-uma-vez"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:p/gateway",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway/{api}": {
      "patch": {
        "operationId": "patch-projects-p-gateway-api",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Update a gateway API",
        "description": "Turning the API on without API keys or a JWKS returns 400 `no_auth_method`.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pathPrefix": {
                    "type": "string",
                    "description": "Path prefix on the project's domains where the API answers (e.g. /api). Unique within the project; /__tenanci, /__external__ and /.well-known are reserved."
                  },
                  "name": {
                    "description": "A name you'll recognize (up to 80 characters).",
                    "type": "string"
                  },
                  "enabled": {
                    "description": "Turns the API on at the edge. Requires API keys or a JWKS.",
                    "type": "boolean"
                  },
                  "apiKeyHeader": {
                    "description": "Header the consumer sends the key in (default x-api-key).",
                    "type": "string"
                  },
                  "allowApiKeys": {
                    "description": "Accept keys issued by Tenanci (default true).",
                    "type": "boolean"
                  },
                  "jwtIssuer": {
                    "description": "Expected issuer (iss) when the consumer uses a JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwtAudience": {
                    "description": "Expected audience (aud) in the JWT.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwksUrl": {
                    "description": "https URL of your identity provider's JWKS (accepts JWTs besides keys).",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rateLimitPerMin": {
                    "description": "Calls per minute per consumer (1 to 1,000,000; default 600).",
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                }
              },
              "example": {
                "rateLimitPerMin": 1200
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
                  "orgId": "org_5t1v",
                  "projectId": "prj_8f3k2m",
                  "name": "API de agendamentos",
                  "pathPrefix": "/api",
                  "enabled": true,
                  "apiKeyHeader": "x-api-key",
                  "allowApiKeys": true,
                  "jwtIssuer": null,
                  "jwtAudience": null,
                  "jwksUrl": null,
                  "rateLimitPerMin": 1200,
                  "createdAt": "2026-10-14T12:00:00.000Z",
                  "updatedAt": "2026-10-15T09:00:00.000Z",
                  "deletedAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "PATCH/projects/:p/gateway/:api",
        "x-scope": "projects:write",
        "x-plan": "scale"
      },
      "delete": {
        "operationId": "delete-projects-p-gateway-api",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Delete a gateway API",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/projects/:p/gateway/:api",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway/{api}/rotate-secret": {
      "post": {
        "operationId": "post-projects-p-gateway-api-rotate-secret",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Rotate the signing secret",
        "description": "The new secret is only shown in this response. Signatures switch to it as soon as the edge gets the new configuration (within moments): update your backend right away. Your backend checks `X-Tenanci-Signature` (HMAC-SHA256 with this secret) on every call the gateway forwards, to reject anything that didn't go through it.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "signingSecret": "EXEMPLO-novo-segredo-de-assinatura"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:p/gateway/:api/rotate-secret",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway/{api}/routes": {
      "get": {
        "operationId": "get-projects-p-gateway-api-routes",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "List API routes",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "id_01JA3N4R8S2T6V0W4X8Y2Z6A0B",
                      "apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
                      "method": "GET",
                      "pathPattern": "/bookings/*",
                      "upstreamUrl": "https://backend.agendafacil.com",
                      "authRequired": true,
                      "scopes": [
                        "bookings:read"
                      ],
                      "stripPrefix": true,
                      "position": 1
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:p/gateway/:api/routes",
        "x-scope": "projects:read",
        "x-plan": "scale"
      },
      "post": {
        "operationId": "post-projects-p-gateway-api-routes",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Add an API route",
        "description": "When several routes match, the most specific path wins; an explicit method only breaks ties.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "method": {
                    "description": "GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS or * (default: all).",
                    "type": "string"
                  },
                  "pathPattern": {
                    "type": "string",
                    "description": "Path relative to the API prefix: exact, \"/x/*\" (/x and everything below) or \"/*\" (everything)."
                  },
                  "upstreamUrl": {
                    "type": "string",
                    "description": "https URL of the backend that receives the call."
                  },
                  "authRequired": {
                    "description": "Require a key or JWT (default true; false makes the route public).",
                    "type": "boolean"
                  },
                  "scopes": {
                    "description": "Scopes the consumer must have.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "stripPrefix": {
                    "description": "Strip the API prefix before forwarding (default true).",
                    "type": "boolean"
                  }
                },
                "required": [
                  "pathPattern",
                  "upstreamUrl"
                ]
              },
              "example": {
                "method": "GET",
                "pathPattern": "/bookings/*",
                "upstreamUrl": "https://backend.agendafacil.com",
                "scopes": [
                  "bookings:read"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "id_01JA3N4R8S2T6V0W4X8Y2Z6A0B",
                  "apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
                  "method": "GET",
                  "pathPattern": "/bookings/*",
                  "upstreamUrl": "https://backend.agendafacil.com",
                  "authRequired": true,
                  "scopes": [
                    "bookings:read"
                  ],
                  "stripPrefix": true,
                  "position": 1
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:p/gateway/:api/routes",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway/{api}/routes/{route}": {
      "delete": {
        "operationId": "delete-projects-p-gateway-api-routes-route",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Remove an API route",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "route",
            "in": "path",
            "required": true,
            "description": "Route id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/projects/:p/gateway/:api/routes/:route",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway/{api}/consumers": {
      "get": {
        "operationId": "get-projects-p-gateway-api-consumers",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "List API consumers",
        "description": "Each consumer comes with its keys (prefix and dates only; the secret is never returned).",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "id": "id_01JA3N6C1D3E5F7G9H1J3K5M7N",
                      "apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
                      "orgId": "org_5t1v",
                      "name": "Barbearia do Zé",
                      "externalId": "barbearia-123",
                      "scopes": [
                        "bookings:read",
                        "bookings:write"
                      ],
                      "rateLimitPerMin": null,
                      "metadata": {
                        "plan": "pro"
                      },
                      "createdAt": "2026-10-14T12:30:00.000Z",
                      "disabledAt": null,
                      "keys": [
                        {
                          "id": "key_01JA3N8P2Q4R6S8T0V2W4X6Y8Z",
                          "prefix": "9f2c4a7e1b",
                          "createdAt": "2026-10-14T12:31:00.000Z",
                          "expiresAt": null,
                          "revokedAt": null
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/projects/:p/gateway/:api/consumers",
        "x-scope": "projects:read",
        "x-plan": "scale"
      },
      "post": {
        "operationId": "post-projects-p-gateway-api-consumers",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Create an API consumer",
        "description": "A consumer is whoever calls your API (a customer, an integration). Then issue a key for it.",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Consumer name (up to 120 characters)."
                  },
                  "externalId": {
                    "description": "Consumer id in your system.",
                    "type": "string"
                  },
                  "scopes": {
                    "description": "Granted scopes (sent to the backend in X-Tenanci-Scopes).",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "rateLimitPerMin": {
                    "description": "Own per-minute limit (null: the API's).",
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "metadata": {
                    "description": "Free-form data for you.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Barbearia do Zé",
                "externalId": "barbearia-123",
                "scopes": [
                  "bookings:read",
                  "bookings:write"
                ],
                "metadata": {
                  "plan": "pro"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "id_01JA3N6C1D3E5F7G9H1J3K5M7N",
                  "apiId": "id_01JA3N2B5C7D9F1G3H5J7K9M1N",
                  "orgId": "org_5t1v",
                  "name": "Barbearia do Zé",
                  "externalId": "barbearia-123",
                  "scopes": [
                    "bookings:read",
                    "bookings:write"
                  ],
                  "rateLimitPerMin": null,
                  "metadata": {
                    "plan": "pro"
                  },
                  "createdAt": "2026-10-14T12:30:00.000Z",
                  "disabledAt": null
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:p/gateway/:api/consumers",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway/{api}/consumers/{consumer}/keys": {
      "post": {
        "operationId": "post-projects-p-gateway-api-consumers-consumer-keys",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Issue a consumer key",
        "description": "`secret` is only shown in this response: hand it to the consumer, who sends it in the API's header (`apiKeyHeader`).",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "consumer",
            "in": "path",
            "required": true,
            "description": "Consumer id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expiresAt": {
                    "description": "Key expiry (ISO 8601). Empty: never expires.",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "example": {
                "expiresAt": "2027-10-14T00:00:00Z"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "id": "key_01JA3N8P2Q4R6S8T0V2W4X6Y8Z",
                  "prefix": "9f2c4a7e1b",
                  "secret": "tgw_9f2c4a7e1b_…",
                  "expiresAt": "2027-10-14T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/projects/:p/gateway/:api/consumers/:consumer/keys",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/projects/{p}/gateway/{api}/keys/{key}": {
      "delete": {
        "operationId": "delete-projects-p-gateway-api-keys-key",
        "tags": [
          "AuthMesh & API Gateway"
        ],
        "summary": "Revoke a consumer key",
        "parameters": [
          {
            "name": "p",
            "in": "path",
            "required": true,
            "description": "Project id (prj_…)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "path",
            "required": true,
            "description": "Gateway API id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "Key id (key_…)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "DELETE/projects/:p/gateway/:api/keys/:key",
        "x-scope": "projects:write",
        "x-plan": "scale"
      }
    },
    "/billing/plans": {
      "get": {
        "operationId": "get-billing-plans",
        "tags": [
          "Plans"
        ],
        "summary": "List plans",
        "description": "Public plans, with price (cents, BRL), included domains, extra-domain packs and features. `current` flags the organization's plan; `available: false` = can't be subscribed to yet.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "features": [
                        "tenantguard",
                        "analytics_basic",
                        "custom_requests"
                      ],
                      "current": false,
                      "code": "starter",
                      "name": "Starter",
                      "currency": "BRL",
                      "priceCents": 0,
                      "includedDomains": 2,
                      "extraDomainPriceCents": 99,
                      "extraPackSize": 0,
                      "extraPackPriceCents": 0,
                      "maxRunningSplitTests": null,
                      "available": true
                    },
                    {
                      "features": [
                        "tenantguard",
                        "analytics_basic",
                        "analytics_advanced",
                        "custom_requests"
                      ],
                      "current": false,
                      "code": "landing",
                      "name": "Landing",
                      "currency": "BRL",
                      "priceCents": 9700,
                      "includedDomains": 10,
                      "extraDomainPriceCents": 99,
                      "extraPackSize": 50,
                      "extraPackPriceCents": 4900,
                      "maxRunningSplitTests": 5,
                      "available": true
                    },
                    {
                      "features": [
                        "tenantguard",
                        "analytics_basic",
                        "analytics_advanced",
                        "custom_requests",
                        "tailorkit",
                        "seo_advanced"
                      ],
                      "current": true,
                      "code": "growth",
                      "name": "Growth",
                      "currency": "BRL",
                      "priceCents": 19900,
                      "includedDomains": 200,
                      "extraDomainPriceCents": 79,
                      "extraPackSize": 100,
                      "extraPackPriceCents": 7900,
                      "maxRunningSplitTests": null,
                      "available": true
                    },
                    {
                      "features": [
                        "tenantguard",
                        "analytics_basic",
                        "analytics_advanced",
                        "custom_requests",
                        "tailorkit",
                        "seo_advanced",
                        "authmesh",
                        "api_gateway"
                      ],
                      "current": false,
                      "code": "scale",
                      "name": "Scale",
                      "currency": "BRL",
                      "priceCents": 34900,
                      "includedDomains": 400,
                      "extraDomainPriceCents": 69,
                      "extraPackSize": 100,
                      "extraPackPriceCents": 6900,
                      "maxRunningSplitTests": null,
                      "available": true
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/billing/plans"
      }
    },
    "/billing/preview": {
      "post": {
        "operationId": "post-billing-preview",
        "tags": [
          "Plans"
        ],
        "summary": "Price preview",
        "description": "What the monthly fee would be after changing plans and/or adding domains, and what would be charged today (prorated, computed by Stripe; `dueNowCents: null` without a Stripe subscription). Changes nothing. `blocked: true` = the plan doesn't buy extra packs and the domains don't fit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plan": {
                    "description": "Plan to simulate (default: the current one).",
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "starter",
                          "landing",
                          "growth",
                          "scale"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "addDomains": {
                    "description": "Domains to add on top of the existing ones.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  }
                }
              },
              "example": {
                "addDomains": 100
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "currency": "BRL",
                  "monthlyCents": 35700,
                  "dueNowCents": 4213,
                  "nextInvoiceAt": "2026-11-01T00:00:00.000Z",
                  "includedDomains": 200,
                  "extraPacks": 2,
                  "packSize": 100,
                  "packPriceCents": 7900,
                  "capacity": 400,
                  "blocked": false
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "POST/billing/preview"
      }
    },
    "/billing/settings": {
      "get": {
        "operationId": "get-billing-settings",
        "tags": [
          "Plans"
        ],
        "summary": "Get billing preferences",
        "description": "`autoExtraPacks`: when the API or MCP goes over the domain limit, the next extra-domain pack is bought automatically. To change it, use the dashboard.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "autoExtraPacks": true
                }
              }
            }
          },
          "default": {
            "description": "Error (`message` in the Accept-Language language; branch on `code`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Domain not found"
                  }
                }
              }
            }
          }
        },
        "x-route": "GET/billing/settings"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer tnc_live_…"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Error": {
        "description": "Error. Branch on `code` (stable, never translated). `message` (and the validation messages in `details`) follows the requested language: `?lang=pt|en` or the `Accept-Language` header (pt-BR or en); without one, the language of the organization that owns the key; otherwise pt-BR.",
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable error code (the contract; doesn't change with the language)."
              },
              "message": {
                "type": "string",
                "description": "Human-readable text, in the requested language (Accept-Language or ?lang=)."
              },
              "details": {
                "description": "Error details, when any (e.g. invalid fields)."
              }
            }
          }
        }
      }
    }
  }
}