{
  "openapi": "3.1.0",
  "info": {
    "title": "Clínica Kanban — API Pública",
    "version": "1.0.0",
    "description": "API server-to-server para a clínica operar exclusivamente os próprios dados. API Keys nunca devem ser usadas no navegador."
  },
  "servers": [
    {
      "url": "https://wabnuxerjnecrjynyyfo.supabase.co/functions/v1/public-api-v1/v1",
      "description": "Produção"
    }
  ],
  "paths": {
    "/account": {
      "get": {
        "operationId": "getAccount",
        "tags": [
          "Conta"
        ],
        "summary": "Get Account",
        "description": "Requer o escopo `account:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "account:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "updateAccount",
        "tags": [
          "Conta"
        ],
        "summary": "Update Account",
        "description": "Requer o escopo `account:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "account:write",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/subscription": {
      "get": {
        "operationId": "getSubscription",
        "tags": [
          "Conta"
        ],
        "summary": "Get Subscription",
        "description": "Requer o escopo `subscription:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "subscription:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/users": {
      "get": {
        "operationId": "listUsers",
        "tags": [
          "Usuários"
        ],
        "summary": "List Users",
        "description": "Requer o escopo `users:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "users:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/users/invitations": {
      "post": {
        "operationId": "inviteUser",
        "tags": [
          "Usuários"
        ],
        "summary": "Invite User",
        "description": "Requer o escopo `users:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "users:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/users/{user_id}": {
      "patch": {
        "operationId": "updateUser",
        "tags": [
          "Usuários"
        ],
        "summary": "Update User",
        "description": "Requer o escopo `users:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "users:write",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/users/{user_id}/deactivate": {
      "post": {
        "operationId": "deactivateUser",
        "tags": [
          "Usuários"
        ],
        "summary": "Deactivate User",
        "description": "Requer o escopo `users:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "users:write",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/users/{user_id}/reactivate": {
      "post": {
        "operationId": "reactivateUser",
        "tags": [
          "Usuários"
        ],
        "summary": "Reactivate User",
        "description": "Requer o escopo `users:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "users:write",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/contacts": {
      "get": {
        "operationId": "listContacts",
        "tags": [
          "Contatos"
        ],
        "summary": "List Contacts",
        "description": "Requer o escopo `contacts:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "contacts:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createContact",
        "tags": [
          "Contatos"
        ],
        "summary": "Create Contact",
        "description": "Requer o escopo `contacts:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "contacts:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/contacts/{contact_id}": {
      "get": {
        "operationId": "getContact",
        "tags": [
          "Contatos"
        ],
        "summary": "Get Contact",
        "description": "Requer o escopo `contacts:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "contacts:read",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "updateContact",
        "tags": [
          "Contatos"
        ],
        "summary": "Update Contact",
        "description": "Requer o escopo `contacts:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "contacts:write",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deleteContact",
        "tags": [
          "Contatos"
        ],
        "summary": "Delete Contact",
        "description": "Requer o escopo `contacts:delete`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "contacts:delete",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/contacts/{contact_id}/move": {
      "post": {
        "operationId": "moveContact",
        "tags": [
          "Contatos"
        ],
        "summary": "Move Contact",
        "description": "Requer o escopo `kanban:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "kanban:write",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/contacts/{contact_id}/follow-up/pause": {
      "post": {
        "operationId": "pauseContactFollowUp",
        "tags": [
          "Contatos"
        ],
        "summary": "Pause Contact Follow Up",
        "description": "Requer o escopo `contacts:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "contacts:write",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/contacts/{contact_id}/follow-up/resume": {
      "post": {
        "operationId": "resumeContactFollowUp",
        "tags": [
          "Contatos"
        ],
        "summary": "Resume Contact Follow Up",
        "description": "Requer o escopo `contacts:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "contacts:write",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/kanban/stages": {
      "get": {
        "operationId": "listKanbanStages",
        "tags": [
          "Kanban"
        ],
        "summary": "List Kanban Stages",
        "description": "Requer o escopo `kanban:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "kanban:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createKanbanStage",
        "tags": [
          "Kanban"
        ],
        "summary": "Create Kanban Stage",
        "description": "Requer o escopo `kanban:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "kanban:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/kanban/stages/{stage_id}": {
      "patch": {
        "operationId": "updateKanbanStage",
        "tags": [
          "Kanban"
        ],
        "summary": "Update Kanban Stage",
        "description": "Requer o escopo `kanban:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "kanban:write",
        "parameters": [
          {
            "name": "stage_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deleteKanbanStage",
        "tags": [
          "Kanban"
        ],
        "summary": "Delete Kanban Stage",
        "description": "Requer o escopo `kanban:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "kanban:write",
        "parameters": [
          {
            "name": "stage_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/kanban/stages/order": {
      "put": {
        "operationId": "reorderKanbanStages",
        "tags": [
          "Kanban"
        ],
        "summary": "Reorder Kanban Stages",
        "description": "Requer o escopo `kanban:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "kanban:write",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/campaigns": {
      "get": {
        "operationId": "listFollowUpCampaigns",
        "tags": [
          "Follow-up"
        ],
        "summary": "List Follow Up Campaigns",
        "description": "Requer o escopo `followups:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createFollowUpCampaign",
        "tags": [
          "Follow-up"
        ],
        "summary": "Create Follow Up Campaign",
        "description": "Requer o escopo `followups:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/campaigns/{campaign_id}": {
      "get": {
        "operationId": "getFollowUpCampaign",
        "tags": [
          "Follow-up"
        ],
        "summary": "Get Follow Up Campaign",
        "description": "Requer o escopo `followups:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:read",
        "parameters": [
          {
            "name": "campaign_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "updateFollowUpCampaign",
        "tags": [
          "Follow-up"
        ],
        "summary": "Update Follow Up Campaign",
        "description": "Requer o escopo `followups:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:write",
        "parameters": [
          {
            "name": "campaign_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/campaigns/{campaign_id}/archive": {
      "post": {
        "operationId": "archiveFollowUpCampaign",
        "tags": [
          "Follow-up"
        ],
        "summary": "Archive Follow Up Campaign",
        "description": "Requer o escopo `followups:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:write",
        "parameters": [
          {
            "name": "campaign_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/campaigns/{campaign_id}/activate": {
      "post": {
        "operationId": "activateFollowUpCampaign",
        "tags": [
          "Follow-up"
        ],
        "summary": "Activate Follow Up Campaign",
        "description": "Requer o escopo `followups:execute`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:execute",
        "parameters": [
          {
            "name": "campaign_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/campaigns/{campaign_id}/pause": {
      "post": {
        "operationId": "pauseFollowUpCampaign",
        "tags": [
          "Follow-up"
        ],
        "summary": "Pause Follow Up Campaign",
        "description": "Requer o escopo `followups:execute`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:execute",
        "parameters": [
          {
            "name": "campaign_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/campaigns/{campaign_id}/templates": {
      "get": {
        "operationId": "listFollowUpTemplates",
        "tags": [
          "Follow-up"
        ],
        "summary": "List Follow Up Templates",
        "description": "Requer o escopo `followups:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:read",
        "parameters": [
          {
            "name": "campaign_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createFollowUpTemplate",
        "tags": [
          "Follow-up"
        ],
        "summary": "Create Follow Up Template",
        "description": "Requer o escopo `followups:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:write",
        "parameters": [
          {
            "name": "campaign_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/templates/{template_id}": {
      "patch": {
        "operationId": "updateFollowUpTemplate",
        "tags": [
          "Follow-up"
        ],
        "summary": "Update Follow Up Template",
        "description": "Requer o escopo `followups:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:write",
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/templates/{template_id}/archive": {
      "post": {
        "operationId": "archiveFollowUpTemplate",
        "tags": [
          "Follow-up"
        ],
        "summary": "Archive Follow Up Template",
        "description": "Requer o escopo `followups:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:write",
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/executions": {
      "get": {
        "operationId": "listFollowUpExecutions",
        "tags": [
          "Follow-up"
        ],
        "summary": "List Follow Up Executions",
        "description": "Requer o escopo `followups:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/follow-ups/metrics": {
      "get": {
        "operationId": "getFollowUpMetrics",
        "tags": [
          "Follow-up"
        ],
        "summary": "Get Follow Up Metrics",
        "description": "Requer o escopo `followups:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "followups:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/ads/contacts": {
      "get": {
        "operationId": "listAdContacts",
        "tags": [
          "Anúncios"
        ],
        "summary": "List Ad Contacts",
        "description": "Requer o escopo `ads:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "ads:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/ads/rules": {
      "get": {
        "operationId": "listAdRules",
        "tags": [
          "Anúncios"
        ],
        "summary": "List Ad Rules",
        "description": "Requer o escopo `ads:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "ads:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createAdRule",
        "tags": [
          "Anúncios"
        ],
        "summary": "Create Ad Rule",
        "description": "Requer o escopo `ads:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "ads:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/ads/rules/{rule_id}": {
      "patch": {
        "operationId": "updateAdRule",
        "tags": [
          "Anúncios"
        ],
        "summary": "Update Ad Rule",
        "description": "Requer o escopo `ads:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "ads:write",
        "parameters": [
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deleteAdRule",
        "tags": [
          "Anúncios"
        ],
        "summary": "Delete Ad Rule",
        "description": "Requer o escopo `ads:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "ads:write",
        "parameters": [
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/links/custom": {
      "get": {
        "operationId": "listCustomLinks",
        "tags": [
          "Links"
        ],
        "summary": "List Custom Links",
        "description": "Requer o escopo `links:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createCustomLink",
        "tags": [
          "Links"
        ],
        "summary": "Create Custom Link",
        "description": "Requer o escopo `links:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/links/custom/{link_id}": {
      "patch": {
        "operationId": "updateCustomLink",
        "tags": [
          "Links"
        ],
        "summary": "Update Custom Link",
        "description": "Requer o escopo `links:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [
          {
            "name": "link_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deleteCustomLink",
        "tags": [
          "Links"
        ],
        "summary": "Delete Custom Link",
        "description": "Requer o escopo `links:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [
          {
            "name": "link_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/links/tracking": {
      "get": {
        "operationId": "listTrackingLinks",
        "tags": [
          "Links"
        ],
        "summary": "List Tracking Links",
        "description": "Requer o escopo `links:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createTrackingLink",
        "tags": [
          "Links"
        ],
        "summary": "Create Tracking Link",
        "description": "Requer o escopo `links:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/links/tracking/{link_id}": {
      "patch": {
        "operationId": "updateTrackingLink",
        "tags": [
          "Links"
        ],
        "summary": "Update Tracking Link",
        "description": "Requer o escopo `links:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [
          {
            "name": "link_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deleteTrackingLink",
        "tags": [
          "Links"
        ],
        "summary": "Delete Tracking Link",
        "description": "Requer o escopo `links:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [
          {
            "name": "link_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/links/contacts": {
      "get": {
        "operationId": "listLinkContacts",
        "tags": [
          "Links"
        ],
        "summary": "List Link Contacts",
        "description": "Requer o escopo `links:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/links/metrics": {
      "get": {
        "operationId": "getLinkMetrics",
        "tags": [
          "Links"
        ],
        "summary": "Get Link Metrics",
        "description": "Requer o escopo `links:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "links:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tags": {
      "get": {
        "operationId": "listTags",
        "tags": [
          "Tags"
        ],
        "summary": "List Tags",
        "description": "Requer o escopo `tags:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "tags:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createTag",
        "tags": [
          "Tags"
        ],
        "summary": "Create Tag",
        "description": "Requer o escopo `tags:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "tags:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/tags/{tag_id}": {
      "patch": {
        "operationId": "updateTag",
        "tags": [
          "Tags"
        ],
        "summary": "Update Tag",
        "description": "Requer o escopo `tags:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "tags:write",
        "parameters": [
          {
            "name": "tag_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deleteTag",
        "tags": [
          "Tags"
        ],
        "summary": "Delete Tag",
        "description": "Requer o escopo `tags:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "tags:write",
        "parameters": [
          {
            "name": "tag_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/contacts/{contact_id}/tags": {
      "put": {
        "operationId": "replaceContactTags",
        "tags": [
          "Contatos"
        ],
        "summary": "Replace Contact Tags",
        "description": "Requer o escopo `tags:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "tags:write",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/services": {
      "get": {
        "operationId": "listServices",
        "tags": [
          "Serviços"
        ],
        "summary": "List Services",
        "description": "Requer o escopo `services:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "services:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createService",
        "tags": [
          "Serviços"
        ],
        "summary": "Create Service",
        "description": "Requer o escopo `services:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "services:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/services/{service_id}": {
      "patch": {
        "operationId": "updateService",
        "tags": [
          "Serviços"
        ],
        "summary": "Update Service",
        "description": "Requer o escopo `services:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "services:write",
        "parameters": [
          {
            "name": "service_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deactivateService",
        "tags": [
          "Serviços"
        ],
        "summary": "Deactivate Service",
        "description": "Requer o escopo `services:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "services:write",
        "parameters": [
          {
            "name": "service_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/appointments": {
      "get": {
        "operationId": "listAppointments",
        "tags": [
          "Agendamentos"
        ],
        "summary": "List Appointments",
        "description": "Requer o escopo `appointments:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "appointments:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createAppointment",
        "tags": [
          "Agendamentos"
        ],
        "summary": "Create Appointment",
        "description": "Requer o escopo `appointments:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "appointments:write",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/appointments/{appointment_id}": {
      "get": {
        "operationId": "getAppointment",
        "tags": [
          "Agendamentos"
        ],
        "summary": "Get Appointment",
        "description": "Requer o escopo `appointments:read`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "appointments:read",
        "parameters": [
          {
            "name": "appointment_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "operationId": "updateAppointment",
        "tags": [
          "Agendamentos"
        ],
        "summary": "Update Appointment",
        "description": "Requer o escopo `appointments:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "appointments:write",
        "parameters": [
          {
            "name": "appointment_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "cancelAppointment",
        "tags": [
          "Agendamentos"
        ],
        "summary": "Cancel Appointment",
        "description": "Requer o escopo `appointments:write`. A clínica é sempre derivada da API Key.",
        "security": [
          {
            "clinicApiKey": []
          }
        ],
        "x-required-scope": "appointments:write",
        "parameters": [
          {
            "name": "appointment_id",
            "in": "path",
            "required": true,
            "description": "Identificador UUID do recurso pertencente à clínica autenticada.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operação concluída com sucesso."
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "clinicApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ck_live_*",
        "description": "API Key da clínica. Envie apenas no header Authorization e nunca em URL ou logs."
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "code",
              "message",
              "request_id"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              },
              "request_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      }
    },
    "responses": {
      "InvalidRequest": {
        "description": "Entrada inválida.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "API Key ausente, inválida, expirada ou revogada.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      },
      "Forbidden": {
        "description": "A API Key não possui o escopo exigido.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      },
      "NotFound": {
        "description": "Recurso não encontrado na clínica autenticada.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      },
      "Conflict": {
        "description": "Conflito de versão, idempotência ou regra de negócio.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Limite de requisições excedido.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      },
      "InternalError": {
        "description": "Erro interno sem detalhes do banco.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            }
          }
        }
      }
    }
  }
}
