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

# Create webhook

> Create an event destination. Returns a signing secret once: store it securely, never include it in reports.

Required permission: `webhooks:write`.



## OpenAPI

````yaml /openapi.json post /webhooks
openapi: 3.1.0
info:
  title: Moonemail API
  version: 0.1.0
  description: >-
    Generated request, response and authorization contract. Covers authenticated
    product endpoints, not public discovery, dashboard assets or Stripe inbound
    webhooks. Go handlers enforce state-dependent and cross-field business
    validation.
servers:
  - url: https://api.moonemail.co
security: []
paths:
  /webhooks:
    post:
      tags:
        - Webhooks
      summary: Create webhook
      description: >-
        Create an event destination. Returns a signing secret once: store it
        securely, never include it in reports.


        Required permission: `webhooks:write`.
      operationId: create_webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                endpoint:
                  type: string
                  format: uri
                  maxLength: 2048
                events:
                  type: array
                  items:
                    type: string
                    enum:
                      - email.sent
                      - email.delivered
                      - email.delivery_delayed
                      - email.complained
                      - email.bounced
                      - email.opened
                      - email.clicked
                      - email.failed
                      - email.received
                      - email.receiving_quarantined
                      - email.scheduled
                      - email.canceled
                      - email.suppressed
                  minItems: 1
              required:
                - endpoint
                - events
              additionalProperties: false
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    const: webhook
                  id:
                    type: string
                  signing_secret:
                    type: string
                    description: Save securely to verify incoming webhook signatures.
                required:
                  - object
                  - id
                  - signing_secret
                additionalProperties: true
        default:
          description: API error
          content:
            application/json:
              schema:
                type: object
                required:
                  - statusCode
                  - name
                  - message
                properties:
                  statusCode:
                    type: integer
                  name:
                    type: string
                  message:
                    type: string
      security:
        - bearerKey: []
components:
  securitySchemes:
    bearerKey:
      type: http
      scheme: bearer
      description: Moonemail API key; x-required-scope applies.

````

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