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

# Create Webhook

> Create a new webhook for the current user.

- **data**: `CreateWebhookPayload` - The data for creating the webhook.
- **user**: `User` - The current authenticated user.

**Returns**: `dict` - The created webhook data.



## OpenAPI

````yaml https://api.loyalty.dog/openapi.json post /v2/webhooks
openapi: 3.1.0
info:
  title: LoyaltyDog
  description: >-

    Welcome to the LoyaltyDog API! This API provides access to our loyalty
    program features, allowing you to integrate with various platforms and
    manage your loyalty data.


    Want to query LoyaltyDog via an AI assistant (Claude, Cursor, Windsurf)? See
    the [MCP Integration guide](https://loyaltydog.ai/playground#mcp).
        
  termsOfService: https://loyalty.dog/loyalty-program-terms-service
  contact:
    name: LoyaltyDog Support
    url: https://loyalty.dog/contact-us
    email: support@loyalty.dog
  version: 1.0.1
servers:
  - url: https://api.loyalty.dog
    description: Production
security:
  - bearerAuth: []
paths:
  /v2/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create Webhook
      description: |-
        Create a new webhook for the current user.

        - **data**: `CreateWebhookPayload` - The data for creating the webhook.
        - **user**: `User` - The current authenticated user.

        **Returns**: `dict` - The created webhook data.
      operationId: create_webhook_v2_webhooks_post
      parameters:
        - name: user-agent
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: User-Agent
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookPayload'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateWebhookPayload:
      properties:
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
        sharedSecret:
          anyOf:
            - type: string
              minLength: 8
            - type: 'null'
          title: Sharedsecret
        allPassTemplates:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Allpasstemplates
        allowedTemplates:
          anyOf:
            - items:
                $ref: '#/components/schemas/PydanticObjectId'
              type: array
            - type: 'null'
          title: Allowedtemplates
        allEventTypes:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Alleventtypes
        allowedEvents:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/WebhookEventType'
                  - type: string
              type: array
            - type: 'null'
          title: Allowedevents
      type: object
      required:
        - url
      title: CreateWebhookPayload
      description: |-
        The webhook creation payload

        Attributes:
            url (str): The webhook URL
            sharedSecret (str | None, optional): A random string to handshake to verify the URL and hmac the event payload data. Defaults to None
            allowedTemplates (List[PydanticObjectId] | None, optional): A list ID of the allowed templates. Defaults to None
            allowedEvents (List[WebhookEventType] | None, optional): A list of allowed webhook types. Defaults to None
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PydanticObjectId:
      type: string
      maxLength: 24
      minLength: 24
      pattern: ^[0-9a-f]{24}$
      example: 5eb7cf5a86d9755df3a6c593
    WebhookEventType:
      type: string
      enum:
        - pass.created
        - pass.updated
        - pass.downloaded
        - pass.installed
        - pass.deleted
        - registration.created
        - registration.deleted
        - scan.performed
        - webhook.verify
        - transaction.completed
        - loyalty.activity.performed
        - loyalty.activity.reward.redeemed
        - loyalty.activity.points.redeemed
        - loyalty.activity.offer.received
        - loyalty.activity.offer.redeemed
        - loyalty.activity.offer.expired
        - loyalty.activity.voucher.received
        - loyalty.activity.voucher.redeemed
        - loyalty.activity.voucher.expired
        - loyalty.activity.points.changed
        - loyalty.activity.email.added
        - loyalty.activity.phone.added
        - loyalty.activity.customer.referred
        - loyalty.activity.custom.field.added
        - loyalty.activity.card.installed
        - loyalty.activity.card.scanned
        - loyalty.customer.created
        - loyalty.customer.updated
        - loyalty.customer.deleted
      title: WebhookEventType
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT access token obtained from POST /v2/token.

````