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

# Create Webhook

> Create a new outbound webhook for the current account.

The `secret` is returned only in this response — store it securely.



## OpenAPI

````yaml post /api/v1/webhooks
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/webhooks:
    post:
      tags:
        - webhooks
        - Webhooks
      summary: Create a new webhook
      description: |-
        Create a new outbound webhook for the current account.

        The `secret` is returned only in this response — store it securely.
      operationId: create_webhook_api_v1_webhooks_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookCreateRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCreateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    WebhookCreateRequest:
      properties:
        url:
          type: string
          maxLength: 2048
          minLength: 1
          title: Url
          description: Destination URL for webhook HTTP POST
        collection:
          type: string
          maxLength: 100
          minLength: 1
          title: Collection
          description: Collection name to watch
        events:
          items:
            type: string
          type: array
          minItems: 1
          title: Events
          description: 'Events to fire on: create, update, delete'
        secret:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Secret
          description: HMAC-SHA256 signing secret (auto-generated if omitted)
        filter:
          anyOf:
            - type: string
            - type: 'null'
          title: Filter
          description: Optional rule expression to conditionally fire webhook
        enabled:
          type: boolean
          title: Enabled
          description: Whether the webhook is active
          default: true
        headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Headers
          description: Optional custom HTTP headers to include in delivery
      type: object
      required:
        - url
        - collection
        - events
      title: WebhookCreateRequest
      description: Request body for creating a webhook.
    WebhookCreateResponse:
      properties:
        id:
          type: string
          title: Id
        account_id:
          type: string
          title: Account Id
        url:
          type: string
          title: Url
        collection:
          type: string
          title: Collection
        events:
          items:
            type: string
          type: array
          title: Events
        filter:
          anyOf:
            - type: string
            - type: 'null'
          title: Filter
        enabled:
          type: boolean
          title: Enabled
        headers:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Headers
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        secret:
          type: string
          title: Secret
          description: Signing secret — save this, it will never be shown again
      type: object
      required:
        - id
        - account_id
        - url
        - collection
        - events
        - filter
        - enabled
        - headers
        - created_at
        - updated_at
        - created_by
        - secret
      title: WebhookCreateResponse
      description: Webhook creation response — includes secret (shown ONCE only).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````