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

# Criar configuração de webhook



## OpenAPI

````yaml https://api.nuvia.ai/api/docs/user-json post /v1/webhooks
openapi: 3.0.0
info:
  title: Nuvia API - Empresa
  description: Documentação da API para empresas
  version: '1.0'
  contact: {}
servers:
  - url: https://api.nuvia.ai
security: []
tags:
  - name: auth
    description: Autenticação
paths:
  /v1/webhooks:
    post:
      tags:
        - Webhooks
      summary: Criar configuração de webhook
      operationId: WebhookController_create
      parameters:
        - name: x-company-id
          in: header
          description: >-
            Identificador da empresa-alvo. Obrigatório apenas para API Keys
            globais (type=global). Ignorado para API Keys de empresa e usuários
            humanos.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookConfigDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookConfigEntity'
      security:
        - bearer: []
components:
  schemas:
    CreateWebhookConfigDto:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: URL do webhook para receber os eventos
        events:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - MESSAGE_SENT
              - MESSAGE_RECEIVED
              - CONVERSATION_UPDATED
              - CONVERSATION_CREATED
              - FOLLOWUP_SENT
              - FIELD_UPDATED
              - CONTACT_CREATED
              - CONTACT_UPDATED
          description: Lista de eventos que dispararão o webhook
        custom_headers:
          type: object
          description: Headers customizados para enviar junto com o webhook
          additionalProperties:
            type: string
        status:
          type: string
          description: Status do webhook (ACTIVE ou INACTIVE)
          enum:
            - ACTIVE
            - INACTIVE
      required:
        - url
        - events
    WebhookConfigEntity:
      type: object
      properties:
        _id:
          $ref: '#/components/schemas/ObjectId'
        company:
          type: object
        url:
          type: string
        events:
          type: array
          items:
            type: string
            enum:
              - MESSAGE_SENT
              - MESSAGE_RECEIVED
              - CONVERSATION_UPDATED
              - CONVERSATION_CREATED
              - FOLLOWUP_SENT
              - FIELD_UPDATED
              - CONTACT_CREATED
              - CONTACT_UPDATED
        custom_headers:
          type: object
        status:
          enum:
            - ACTIVE
            - INACTIVE
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - _id
        - company
        - url
        - events
        - custom_headers
        - status
    ObjectId:
      type: object
      properties: {}
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````