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

# Create Webhook

> Allows the user to specify multiple store IDs in Komerza.Common.Forms.Users.WebhookForm.StoreIds.
Requires the `user.webhooks.create` permission.



## OpenAPI

````yaml POST /webhooks
openapi: 3.0.4
info:
  title: Komerza API
  description: >-
    The base Komerza API for interfacing with the Komerza platform through a
    REST interface.
  termsOfService: https://komerza.com/terms
  contact:
    name: Support
    url: https://help.komerza.com
    email: support@komerza.com
  version: vUnknown-Development
servers:
  - url: https://api.komerza.com
    description: The production Komerza API
security:
  - bearer: []
tags:
  - name: Affiliate
    description: Manage store affiliates.
  - name: Analytics
    description: >-
      Analytics endpoints for a store: store dashboard, visitor dashboard and
      daily stats.
  - name: Application
    description: Manages OAuth2 applications owned by users for third-party integrations.
  - name: Billing
    description: Provides billing-related endpoints for user accounts.
  - name: Blacklist
    description: Manages blacklist rules and customer blocking for a store.
  - name: BlogCategory
    description: Manages blog categories for a store.
  - name: BlogPost
    description: Manages blog posts for a store.
  - name: Category
    description: >-
      Handles the management of categories, which are used to organize products
      within a store.
  - name: Coupon
    description: >-
      Handles the management of coupons, which are used to give customers a
      percentage discount off any products in your

      store
  - name: Customer
    description: Controller that handles customer-related actions.
  - name: CustomField
    description: Controller for managing custom fields on a product variant.
  - name: CustomPaymentMethod
    description: >-
      Manages custom payment methods for a store (Instructions and Redirect
      types).
  - name: Discord
    description: >-
      Manages Discord integration settings, variant roles, product overrides,
      and grants.
  - name: DiscountDialog
    description: >-
      Handles the management of discount dialogs, which are promotional popups
      displayed on storefronts

      to encourage customer engagement through discount offers.
  - name: Domain
    description: >-
      Controller that handles all store domain-related concerns, like URLs and
      custom domains.
  - name: EmailMarketing
    description: Manages email marketing setup and status for a store
  - name: EmailMarketingCampaign
    description: Manages email campaigns (create, schedule, send, cancel)
  - name: EmailMarketingCredit
    description: Manages email marketing credit packages and purchases
  - name: EmailMarketingDomain
    description: Manages email sending domains for a store (add, verify, delete)
  - name: EmailMarketingRecipient
    description: Manages email recipient lists and their entries
  - name: EmailMarketingSuppression
    description: Manages email suppressions (unsubscribes, bounces, complaints) for a store
  - name: EmailMarketingTemplate
    description: Manages email templates (GrapeJS editor JSON + compiled HTML)
  - name: EmailUnsubscribe
    description: Public endpoint for email unsubscribe (no authentication required)
  - name: FlaggedUsers
    description: Controller for managing flagged users in the administration panel.
  - name: LicenseKey
    description: >-
      Controller that handles license key/item operations including search and
      inventory management.
  - name: OAuth
    description: Controller responsible for handling OAuth2 operations.
  - name: Onboarding
    description: >-
      Manages the merchant onboarding setup guide, including progress tracking,
      step completion, and dismissal.
  - name: Order
    description: Controller that handles order-related concerns.
  - name: Passkey
    description: Manages FIDO2/WebAuthn passkeys for two-factor authentication.
  - name: Product
    description: >-
      Handles creation, retrieval, updating, and deletion of products within a
      store.
  - name: Review
    description: ''
  - name: Store
    description: >-
      Manages actions related to stores in the system, such as creating,
      updating, and retrieving store information.
  - name: StoreBranding
    description: >-
      Provides functionalities for managing store branding and related
      configurations.
  - name: Subscription
    description: Controller for merchant management of customer subscriptions.
  - name: Tax
    description: Manages tax/VAT settings and rules for a store.
  - name: Temp
  - name: Ticket
    description: Handles ticket replies and closure
  - name: User
    description: Manages user-related functionalities and actions for the platform.
  - name: Variant
    description: >-
      Controller which handles management of product variants, including
      creation, updates, deletion,

      file and image uploads, and delivery settings.
  - name: VolumeDiscount
    description: Controller for managing volume discount tiers on a product variant.
  - name: Webhook
    description: Controller for managing webhook operations within the system.
paths:
  /webhooks:
    post:
      tags:
        - Webhook
      summary: Create a new webhook (account-wide).
      description: >-
        Allows the user to specify multiple store IDs in
        Komerza.Common.Forms.Users.WebhookForm.StoreIds.

        Requires the `user.webhooks.create` permission.
      requestBody:
        description: >-
          The Komerza.Common.Forms.Users.WebhookForm containing URL, events, and
          store IDs
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookForm'
      responses:
        '200':
          description: The object was successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCreatedResponseResponse'
        '400':
          description: >-
            The provided form information is not valid, check that the provided
            data is valid. You can use the 'invalidFields' field to get the list
            of invalid fields or just use the 'message' field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponse'
        '401':
          description: You are not authorized, check your API key and try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponse'
        '403':
          description: >-
            You are not authorized to access this endpoint, you may be missing
            an API key scope or be requesting a privileged endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponse'
components:
  schemas:
    WebhookForm:
      required:
        - eventTypes
        - storeIds
        - url
      type: object
      properties:
        url:
          minLength: 1
          type: string
          description: |-
            The URL associated with this webhook.
            Required and must be a valid URL.
          format: uri
        eventTypes:
          maxItems: 9999
          minItems: 1
          type: array
          items:
            type: string
          description: |-
            The event types this webhook should subscribe to.
            Must contain at least one entry.
        storeIds:
          maxItems: 999
          minItems: 1
          type: array
          items:
            type: string
            format: uuid
          description: The list of store IDs to which this webhook will be linked.
      additionalProperties: false
      description: |-
        Represents a form for configuring webhooks.
        This form includes a URL for the webhook, a list of event types,
        and a list of store IDs the webhook should apply to.
    WebhookCreatedResponseResponse:
      required:
        - success
      type: object
      properties:
        success:
          type: boolean
          description: Indicates whether the operation or response was successful.
        message:
          type: string
          description: >-
            A descriptive message providing additional context or information
            about the response.
          nullable: true
        code:
          type: string
          description: >-
            The error code (if there was an error) to use when referencing the
            error
          nullable: true
        data:
          $ref: '#/components/schemas/WebhookCreatedResponse'
      additionalProperties: false
      description: Represents a default generic response for API endpoints.
    ObjectResponse:
      required:
        - success
      type: object
      properties:
        success:
          type: boolean
          description: Indicates whether the operation or response was successful.
        message:
          type: string
          description: >-
            A descriptive message providing additional context or information
            about the response.
          nullable: true
        code:
          type: string
          description: >-
            The error code (if there was an error) to use when referencing the
            error
          nullable: true
        data:
          description: Represents the data associated with a response.
          nullable: true
      additionalProperties: false
      description: Represents a default generic response for API endpoints.
    WebhookCreatedResponse:
      required:
        - secret
        - webhook
      type: object
      properties:
        webhook:
          $ref: '#/components/schemas/Webhook'
        secret:
          type: string
      additionalProperties: false
    Webhook:
      required:
        - dateCreated
        - events
        - executionLogs
        - id
        - storeIds
        - url
        - userId
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the entity
          format: uuid
        dateCreated:
          type: string
          description: The date the entity was created in the database
          format: date-time
        url:
          maxLength: 3000
          minLength: 1
          type: string
          description: |-
            The URL that the webhook will send data to.
            This is required and must not exceed 3000 characters in length.
        events:
          type: array
          items:
            type: string
          description: The events that the webhook is subscribed to.
        storeIds:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            The list of store IDs this webhook applies to.

            Storing as an array of Guid. You can keep a bridging table if
            needed,

            but here we store them directly in the Webhook entity.
        executionLogs:
          type: array
          items:
            $ref: '#/components/schemas/WebhookExecutionLog'
          description: Execution logs associated with this webhook.
        userId:
          maxLength: 36
          minLength: 1
          type: string
          description: The user who owns this webhook.
      additionalProperties: false
      description: |-
        Merchant-facing webhook, V2 system not the old one.
        Supports multiple store IDs in StoreIds.
    WebhookExecutionLog:
      required:
        - dateCreated
        - id
        - requestBody
        - retryCount
        - signature
        - url
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the entity
          format: uuid
        dateCreated:
          type: string
          description: The date the entity was created in the database
          format: date-time
        url:
          maxLength: 2048
          type: string
          description: The URL associated with the webhook execution log.
        signature:
          maxLength: 128
          type: string
          description: >-
            The signature of the webhook execution, used for validation and
            security purposes.
        requestBody:
          maxLength: 8192
          type: string
          description: The body of the request sent in a webhook execution.
        responseCode:
          type: integer
          description: The HTTP response code resulting from executing the webhook.
          format: int32
          nullable: true
        responseBody:
          maxLength: 8192
          type: string
          description: The response body returned by a webhook execution log.
          nullable: true
        webhookId:
          type: string
          description: The unique identifier of the webhook associated with this log.
          format: uuid
          nullable: true
        userId:
          maxLength: 36
          type: string
          description: >-
            The ID of the user who owns the webhook. Nullable for backwards
            compatibility

            with existing logs that predate this field.
          nullable: true
        retryCount:
          type: integer
          description: >-
            The number of times this webhook has been dispatched (initial +
            retries via Hangfire requeue).

            Starts at 1 for the first attempt and increments on each resend.
          format: int32
        userAgent:
          maxLength: 512
          type: string
          description: The user agent header sent to the merchant's endpoint.
          nullable: true
        orderId:
          type: string
          description: >-
            The unique identifier for the order associated with the webhook
            execution log.
          format: uuid
          nullable: true
      additionalProperties: false
      description: A log for a webhook execution.
  securitySchemes:
    bearer:
      type: http
      description: Your API key goes here
      scheme: bearer
      bearerFormat: JWT

````