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

# Create a new webhook

> Creates a new webhook endpoint for receiving event notifications. Requires webhook:create scope.



## OpenAPI

````yaml /swagger.yml post /api/v0/webhooks
openapi: 3.0.0
info:
  title: Devdraft AI Payment & Business Management API
  description: >-

    A comprehensive payment processing and business management API that enables
    seamless integration of cryptocurrency and traditional payment methods.
        
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.devdraft.ai
    description: Production Server
security: []
tags: []
paths:
  /api/v0/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create a new webhook
      description: >-
        Creates a new webhook endpoint for receiving event notifications.
        Requires webhook:create scope.
      operationId: WebhookController_create
      parameters: []
      requestBody:
        required: true
        description: Webhook configuration details
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookDto'
      responses:
        '201':
          description: The webhook has been successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponseDto'
        '400':
          description: Invalid input data.
          content:
            application/json: {}
        '401':
          description: Unauthorized - Missing or invalid API key.
          content:
            application/json: {}
        '403':
          description: Forbidden - Missing required scope or API key not found.
          content:
            application/json: {}
      security:
        - x-client-secret: []
        - x-client-key: []
components:
  schemas:
    CreateWebhookDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the webhook for identification purposes
          example: Payment Notifications
          minLength: 3
          maxLength: 100
        url:
          type: string
          description: URL where webhook events will be sent
          example: https://api.example.com/webhooks/payments
          format: uri
        isActive:
          type: boolean
          description: Whether the webhook is active and will receive events
          example: true
          default: true
        signing_secret:
          type: string
          description: Secret key used to sign webhook payloads for verification
          example: whsec_123456789
        encrypted:
          type: boolean
          description: Whether webhook payloads should be encrypted
          example: false
          default: false
      required:
        - name
        - url
        - isActive
        - encrypted
    WebhookResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the webhook
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          description: Name of the webhook
          example: Payment Notifications
        url:
          type: string
          description: URL where webhook events are sent
          example: https://api.example.com/webhooks/payments
        isActive:
          type: boolean
          description: Whether the webhook is currently active
          example: true
        encrypted:
          type: boolean
          description: Whether webhook payloads are encrypted
          example: false
        created_at:
          type: string
          description: Timestamp when the webhook was created
          example: '2024-03-20T12:00:00.000Z'
        updated_at:
          type: string
          description: Timestamp when the webhook was last updated
          example: '2024-03-20T12:00:00.000Z'
        delivery_stats:
          type: object
          description: Webhook delivery statistics
          example:
            total_events: 150
            successful_deliveries: 145
            failed_deliveries: 5
            last_delivery: '2024-03-20T11:55:00.000Z'
      required:
        - id
        - name
        - url
        - isActive
        - encrypted
        - created_at
        - updated_at
        - delivery_stats
  securitySchemes:
    x-client-secret:
      type: apiKey
      in: header
      name: x-client-secret
      description: >-
        Your secret API key. Keep this secure and never expose it in client-side
        code.
    x-client-key:
      type: apiKey
      in: header
      name: x-client-key
      description: Your unique client API key. Obtain this from your Devdraft AI dashboard.

````