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

# Create a webhook endpoint



## OpenAPI

````yaml POST /v1/webhook-endpoints
openapi: 3.1.0
info:
  title: PolyAI Alerts API
  version: 1.0.0
  description: >-
    Create alert rules, inspect active alerts, register webhook endpoints, and
    receive signed webhook notifications when alert thresholds are breached.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.uk.poly.ai
    description: UK region
  - url: https://api.eu.poly.ai
    description: EU region
security:
  - ApiKeyAuth: []
paths:
  /v1/webhook-endpoints:
    post:
      summary: Create a webhook endpoint
      operationId: createWebhookEndpoint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookEndpointRequest'
      responses:
        '201':
          description: Webhook endpoint created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEndpointCreateResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CreateWebhookEndpointRequest:
      type: object
      required:
        - name
        - url
        - event_types
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        url:
          type: string
          format: uri
          pattern: ^https://
        event_types:
          type: array
          items:
            $ref: '#/components/schemas/WebhookEventType'
          minItems: 1
        headers:
          type: object
          additionalProperties:
            type: string
        timeout_ms:
          type: integer
          minimum: 1000
          maximum: 30000
          default: 5000
        enabled:
          type: boolean
          default: true
      additionalProperties: false
      example:
        name: Production alerts
        url: https://example.com/webhooks/polyai
        event_types:
          - alerts.triggered
        headers:
          X-Custom-Header: my-value
        timeout_ms: 5000
        enabled: true
    WebhookEndpointCreateResponse:
      allOf:
        - $ref: '#/components/schemas/WebhookEndpoint'
        - type: object
          required:
            - signing_secret
          properties:
            signing_secret:
              type: string
              description: Returned only once during endpoint creation. Store it securely.
    WebhookEventType:
      type: string
      enum:
        - alerts.triggered
        - alerts.resolved
    WebhookEndpoint:
      type: object
      required:
        - id
        - name
        - url
        - enabled
        - event_types
        - timeout_ms
        - created_at
        - updated_at
      properties:
        id:
          type: string
          pattern: ^whe_[A-Za-z0-9]+$
          example: whe_9ZtRcXw3nByK5pVqMaEfJs
        name:
          type: string
          minLength: 1
          maxLength: 255
        url:
          type: string
          format: uri
        enabled:
          type: boolean
          default: true
        event_types:
          type: array
          items:
            $ref: '#/components/schemas/WebhookEventType'
        headers:
          type: object
          additionalProperties:
            type: string
          default: {}
        timeout_ms:
          type: integer
          minimum: 1000
          maximum: 30000
          default: 5000
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        message:
          type: string
  responses:
    BadRequest:
      description: Validation error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: >-
        Resource limit exceeded (e.g. maximum number of alert rules or webhook
        endpoints reached).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableEntity:
      description: Validation error or malformed resource ID.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````