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

# Create Webhook Subscription



## OpenAPI

````yaml POST /api/v1/mgt/workspaces/{workspaceId}/webhook-subscriptions
openapi: 3.1.0
info:
  title: Xenia Team API - Create Webhook Subscription
  version: 1.0.0
  description: Create a new webhook subscription to receive real-time event notifications.
servers:
  - url: https://api.xenia.team
security: []
paths:
  /api/v1/mgt/workspaces/{workspaceId}/webhook-subscriptions:
    post:
      tags:
        - Webhooks
      summary: Create Webhook Subscription
      description: >-
        Creates a new webhook subscription. The response includes a secret that
        is only shown once - store it securely.
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Workspace ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - url
                - events
              properties:
                name:
                  type: string
                  maxLength: 255
                  description: Subscription name
                url:
                  type: string
                  format: uri
                  maxLength: 2048
                  description: HTTPS URL to receive webhooks
                events:
                  type: array
                  minItems: 1
                  maxItems: 50
                  items:
                    type: string
                  description: Event types to subscribe to
                description:
                  type: string
                  maxLength: 2000
                  description: Optional description
                rateLimit:
                  type: integer
                  minimum: 1
                  maximum: 1000
                  default: 100
                  description: Requests per minute limit
                metadata:
                  type: object
                  additionalProperties: true
                  description: Custom key-value metadata
            example:
              name: Production Task Notifications
              url: https://api.yourapp.com/webhooks/xenia
              events:
                - task.status_changed
                - submission.submitted
              description: Webhook for production environment
              rateLimit: 100
      responses:
        '201':
          description: Subscription created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  code:
                    type: integer
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      url:
                        type: string
                      events:
                        type: array
                        items:
                          type: string
                      secret:
                        type: string
                        description: 64-character hex string. Only shown once!
                      isActive:
                        type: boolean
                      rateLimit:
                        type: integer
                      createdAt:
                        type: string
                        format: date-time
              example:
                status: true
                code: 201
                data:
                  id: sub_abc123
                  name: Production Task Notifications
                  url: https://api.yourapp.com/webhooks/xenia
                  events:
                    - task.status_changed
                    - submission.submitted
                  secret: >-
                    a1b2c3d4e5f6789012345678901234567890123456789012345678901234abcd
                  isActive: true
                  rateLimit: 100
                  createdAt: '2024-12-23T10:00:00Z'
        '400':
          description: Bad Request - Invalid parameters
        '401':
          description: Unauthorized
        '403':
          description: Forbidden - WEBHOOKS feature not enabled
        '422':
          description: Unprocessable Entity - Invalid event types
      security:
        - clientKey: []
          clientSecret: []
components:
  securitySchemes:
    clientKey:
      type: apiKey
      in: header
      name: x-client-key
    clientSecret:
      type: apiKey
      in: header
      name: x-client-secret

````