openapi: 3.1.0
info:
  title: HookCloud Partner API
  version: 2026.07
  description: API para clientes, instâncias, webhooks, templates e saúde de entregas.
servers:
  - url: https://api.hookcloud.app
paths:
  /functions/v1/swift-worker:
    get:
      summary: Consultas da Partner API
      parameters:
        - in: query
          name: route
          required: true
          schema:
            type: string
            enum: [get-partner-instance, get-partner-webhook-migration, list-partner-meta-templates, get-partner-meta-template, get-partner-meta-template-sync, get-partner-delivery-health, search-partner-delivery-events]
        - in: query
          name: instance_id
          schema: { type: string, format: uuid }
        - in: query
          name: instance_key
          schema: { type: string }
        - in: query
          name: phone_number_id
          schema: { type: string }
        - in: header
          name: apikey
          required: true
          schema: { type: string }
      security: [{ partnerBearer: [] }]
      responses:
        '200': { description: Sucesso }
        '400': { description: Parâmetros inválidos }
        '401': { description: Não autenticado }
        '403': { description: Acesso negado }
    post:
      summary: Comandos da Partner API
      parameters:
        - in: header
          name: apikey
          required: true
          schema: { type: string }
      security: [{ partnerBearer: [] }]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [route]
              properties:
                route:
                  type: string
                  enum: [upsert-partner-customer, create-customer-instance, create-connect-session, refresh-partner-instance-meta, update-partner-instance-label, reveal-partner-instance-meta-token, deactivate-partner-instance, deactivate-partner-customer, reactivate-partner-customer, validate-partner-webhook-endpoint, update-partner-webhook-endpoint, retry-partner-webhook-migration, refresh-partner-meta-templates, report-partner-message-status, report-partner-message-delivery-failure]
              additionalProperties: true
      responses:
        '200': { description: Sucesso }
        '201': { description: Recurso criado }
        '202': { description: Processamento aceito }
        '409': { description: Conflito operacional }
components:
  securitySchemes:
    partnerBearer:
      type: http
      scheme: bearer
      bearerFormat: hc_partner_live
