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

# Criar webhook

> Cria um novo endpoint de webhook. O response inclui um `secret` que você deve armazenar — ele é usado para verificar o header `X-JuriChat-Signature` em cada entrega.



## OpenAPI

````yaml https://api.jurichat.com/docs/client/openapi.json post /webhooks/
openapi: 3.1.0
info:
  title: JuriChat API — Documentação para Integradores
  description: ''
  version: 1.0.0
servers:
  - url: https://api.jurichat.com
    description: Production server
security:
  - apiKeyAuth: []
tags: []
paths:
  /webhooks/:
    post:
      tags:
        - Webhooks
      summary: Criar webhook
      description: >-
        Cria um novo endpoint de webhook. O response inclui um `secret` que você
        deve armazenar — ele é usado para verificar o header
        `X-JuriChat-Signature` em cada entrega.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: >-
                    Nome legível para este endpoint de webhook (ex.: "Integração
                    com CRM").
                description:
                  type: string
                  maxLength: 500
                  description: Descrição opcional explicando para que este webhook é usado.
                url:
                  type: string
                  format: uri
                  description: >-
                    A URL HTTPS que receberá os payloads de evento via HTTP
                    POST.
                events:
                  type: array
                  items:
                    type: string
                    enum:
                      - crm.lead.created
                      - crm.lead.updated
                      - crm.lead.deleted
                      - crm.lead.moved
                      - crm.lead.overdue
                      - chat.conversation.created
                      - chat.conversation.updated
                      - chat.conversation.assigned
                      - chat.message.received
                      - chat.message.sent
                      - contact.created
                      - contact.updated
                      - contact.deleted
                      - webhook.test
                  minItems: 1
                  description: >-
                    Lista de nomes de eventos para se inscrever. Use `GET
                    /webhooks/events` para listar todos os eventos disponíveis.
                isActive:
                  type: boolean
                  default: true
                  description: >-
                    Se este webhook está ativo. Webhooks inativos não recebem
                    nenhum evento.
                headers:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Cabeçalhos HTTP personalizados opcionais para incluir em
                    cada requisição de entrega (ex.: `{"Authorization": "Bearer
                    token"}`).
              required:
                - name
                - url
                - events
              additionalProperties: false
        required: true
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID único do webhook.
                  officeId:
                    type: string
                    description: ID do escritório ao qual este webhook pertence.
                  name:
                    type: string
                    description: Nome do webhook.
                  description:
                    type: string
                    nullable: true
                    description: Descrição do webhook.
                  url:
                    type: string
                    description: URL de destino para entregas de eventos.
                  secret:
                    type: string
                    description: >-
                      HMAC-SHA256 segredo de autenticação usado para verificar o
                      header `X-JuriChat-Signature` em cada entrega.
                  events:
                    type: array
                    items:
                      type: string
                    description: Lista de nomes de eventos inscritos.
                  isActive:
                    type: boolean
                    description: Se este webhook está ativo.
                  headers:
                    type: object
                    additionalProperties:
                      type: string
                    nullable: true
                    description: Cabeçalhos personalizados enviados com cada entrega.
                  createdAt:
                    type: string
                    description: Timestamp de criação ISO 8601.
                  updatedAt:
                    type: string
                    description: Timestamp de última atualização ISO 8601.
                required:
                  - id
                  - officeId
                  - name
                  - description
                  - url
                  - secret
                  - events
                  - isActive
                  - headers
                  - createdAt
                  - updatedAt
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  statusCode:
                    type: number
                  details: {}
                required:
                  - message
                  - statusCode
                additionalProperties: false
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-jurichat-api-key
      description: >-
        Chave de API do escritório (criada no painel). Envie o valor no header
        x-jurichat-api-key.

````