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

# Create a webhook

> Create a webhook subscribed to one or more event types. Deliveries use the v2 envelope and are signed with the project signing secret (see the signing secret endpoint).



## OpenAPI

````yaml post /webhooks
openapi: 3.1.0
info:
  title: Moderation API
  description: API for automated content moderation
  version: 1.1.0
servers:
  - url: https://api.moderationapi.com/v1
security: []
tags:
  - name: Actions
  - name: Queues
  - name: Webhooks
  - name: Wordlist
  - name: UserReports
  - name: Projects
  - name: Channels
  - name: Voice
    description: Real-time voice moderation over WebSocket.
externalDocs:
  url: https://docs.moderationapi.com
paths:
  /webhooks:
    post:
      tags:
        - Webhooks
      summary: Create a webhook
      description: >-
        Create a webhook subscribed to one or more event types. Deliveries use
        the v2 envelope and are signed with the project signing secret (see the
        signing secret endpoint).
      operationId: webhooks-publicCreate
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  description: The webhook's name, used to identify it in the dashboard
                description:
                  description: The webhook's description
                  type:
                    - string
                    - 'null'
                url:
                  type: string
                  format: uri
                  description: The webhook's URL. We'll call this URL when an event occurs.
                eventTypes:
                  minItems: 1
                  type: array
                  items:
                    type: string
                    enum:
                      - QUEUE_ITEM_NEW
                      - QUEUE_ITEM_COMPLETED
                      - QUEUE_ITEM_ACTION
                      - QUEUE_ITEM_REJECTED
                      - QUEUE_ITEM_ALLOWED
                      - AUTHOR_BLOCKED
                      - AUTHOR_UNBLOCKED
                      - AUTHOR_SUSPENDED
                      - AUTHOR_UPDATED
                      - AUTHOR_TRUST_LEVEL_CHANGED
                      - AUTHOR_ACTION
                  description: >-
                    Event types this webhook subscribes to. One webhook URL
                    receives all events you list here.
              required:
                - name
                - url
                - eventTypes
      responses:
        '200':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the webhook.
                  name:
                    type: string
                    description: The webhook's name.
                  description:
                    description: The webhook's description.
                    type:
                      - string
                      - 'null'
                  url:
                    type: string
                    description: The URL we call when a subscribed event occurs.
                  eventTypes:
                    default: []
                    description: >-
                      Event types this webhook subscribes to. Empty for legacy
                      v1 webhooks, which subscribe via their single deprecated
                      `type` instead.
                    type: array
                    items:
                      type: string
                      enum:
                        - QUEUE_ITEM_NEW
                        - QUEUE_ITEM_COMPLETED
                        - QUEUE_ITEM_ACTION
                        - QUEUE_ITEM_REJECTED
                        - QUEUE_ITEM_ALLOWED
                        - AUTHOR_BLOCKED
                        - AUTHOR_UNBLOCKED
                        - AUTHOR_SUSPENDED
                        - AUTHOR_UPDATED
                        - AUTHOR_TRUST_LEVEL_CHANGED
                        - AUTHOR_ACTION
                  payloadVersion:
                    type: string
                    enum:
                      - V1
                      - V2
                    description: >-
                      Payload envelope version. V2 is the Stripe-style envelope;
                      V1 is the legacy flat shape and is read-only via this API.
                  createdAt:
                    description: The date the webhook was created.
                    type: string
                required:
                  - id
                  - name
                  - url
                  - eventTypes
                  - payloadVersion
                  - createdAt
                additionalProperties: false
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
      security:
        - Authorization: []
components:
  schemas:
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.UNAUTHORIZED:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Authorization not provided
        code:
          type: string
          description: The error code
          example: UNAUTHORIZED
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````