> ## Documentation Index
> Fetch the complete documentation index at: https://docs.watahub.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Criar um link de conexão

> Criar um link de conexão



## OpenAPI

````yaml pt-BR/openapi.json POST /v1/setup-links
openapi: 3.1.0
info:
  title: Watahub API
  version: 0.2.0
  description: >-
    API para clientes do Watahub, gateway multiempresa da WhatsApp Cloud API.
    Autentique cada requisição com `Authorization: Bearer <key>` ou `X-API-Key:
    <key>`. Os contratos próprios são fechados; os registros da Meta preservam
    campos adicionais. O proxy `/vN.N` preserva o corpo e o status da Meta;
    aceita a versão da rota, mas a ignora.
servers:
  - url: https://cloud.watahub.dev
security:
  - bearerApiKey: []
  - headerApiKey: []
tags:
  - name: Messages
  - name: Media
  - name: Templates
  - name: Graph-compatible proxy
    description: >-
      Compatibilidade com o Graph da Meta em três rotas. Retorna a resposta da
      Meta sem alterações.
  - name: Phones
    description: Telefones
  - name: Conversations
    description: Conversas
  - name: Connect
    description: Conexão
  - name: Customers
    description: Clientes
  - name: Webhooks
    description: Webhooks
  - name: Logs
    description: Registros
  - name: Health
    description: Status do serviço
  - name: Message templates
    description: >-
      Modelos por WABA em cache no gateway, sincronizados da Meta e necessários
      para campanhas.
  - name: Broadcasts
    description: >-
      Envia um modelo aprovado para até 500 destinatários; processado em fila e
      em segundo plano.
paths:
  /v1/setup-links:
    post:
      tags:
        - Connect
      summary: Criar um link de conexão
      description: >-
        Embedded Signup hospedado. Somente o hash do token é armazenado; o
        gateway mantém o token da Meta sob custódia.
      operationId: createSetupLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetupLinkCreate'
      responses:
        '201':
          description: Link de conexão.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SetupLink'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    SetupLinkCreate:
      type: object
      additionalProperties: false
      required:
        - allowedOrigins
      properties:
        allowedOrigins:
          type: array
          minItems: 1
          maxItems: 8
          items:
            type: string
            maxLength: 200
            description: Origem HTTPS exata, por exemplo https://app.example.com
        successRedirectUrl:
          type: string
          maxLength: 2000
          description: URL HTTPS em um dos allowedOrigins.
        failureRedirectUrl:
          type: string
          maxLength: 2000
        customerId:
          type: string
          format: uuid
        allowedConnectionTypes:
          type: array
          minItems: 1
          maxItems: 2
          uniqueItems: true
          items:
            $ref: '#/components/schemas/ConnectionType'
          default:
            - dedicated
            - coexistence
    SetupLink:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: >-
            Página hospedada do Embedded Signup /connect/{token}. Uso único;
            expira em 1 hora.
        token:
          type: string
        expiresAt:
          type: integer
          format: int64
          description: Milissegundos desde Unix epoch.
        customerId:
          type:
            - string
            - 'null'
        allowedConnectionTypes:
          type: array
          items:
            $ref: '#/components/schemas/ConnectionType'
        successRedirectUrl:
          type:
            - string
            - 'null'
        failureRedirectUrl:
          type:
            - string
            - 'null'
    ConnectionType:
      type: string
      enum:
        - dedicated
        - coexistence
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  responses:
    BadRequest:
      description: Dados inválidos (validação ou rota não canônica).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Chave de API ausente ou inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: A conta exige pagamento.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Recurso inexistente ou de outra conta.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        Muitas requisições (limite da conta, 10 chaves inválidas/min por IP ou
        20 links de conexão/hora).
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: >-
        Gateway pausado, em manutenção ou sem configuração do aplicativo da
        Meta.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      description: Chave de API da conta.
    headerApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Chave de API da conta.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.