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

# Create Webhook

> Register a webhook endpoint. Cartesia POSTs [call events](/line/infrastructure/observability#webhooks) to its `url` for every agent the webhook is attached to. Attach a webhook to an agent by setting the agent's `webhook_id` with [Update Agent](/api-reference/agents/agents/update).



## OpenAPI

````yaml latest.yml POST /agents/webhooks
openapi: 3.0.1
info:
  title: Cartesia API
  version: 0.0.1
servers:
  - url: https://api.cartesia.ai
    description: Production
security: []
paths:
  /agents/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create Webhook
      description: >-
        Register a webhook endpoint. Cartesia POSTs [call
        events](/line/infrastructure/observability#webhooks) to its `url` for
        every agent the webhook is attached to. Attach a webhook to an agent by
        setting the agent's `webhook_id` with [Update
        Agent](/api-reference/agents/agents/update).
      operationId: webhooks_create
      parameters:
        - $ref: '#/components/parameters/CartesiaVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookBody'
      responses:
        '200':
          description: >-
            Webhook created. The response includes the `secret` — this is the
            only time it is returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentWebhookResponse'
      security:
        - APIKeyAuth: []
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST "https://api.cartesia.ai/agents/webhooks" \
              -H "X-API-Key: your-api-key" \
              -H "Cartesia-Version: 2026-03-01" \
              -H "Content-Type: application/json" \
              -d '{
                "url": "https://your-server.example/webhooks/cartesia",
                "secret": "YOUR_WEBHOOK_SECRET"
              }'
components:
  parameters:
    CartesiaVersionHeader:
      name: Cartesia-Version
      in: header
      description: API version header.
      required: true
      schema:
        type: string
        format: date
        example: '2026-03-01'
        enum:
          - '2026-03-01'
  schemas:
    CreateWebhookBody:
      title: CreateWebhookBody
      type: object
      properties:
        url:
          type: string
          format: uri
          description: The HTTPS endpoint Cartesia POSTs call events to.
        secret:
          type: string
          description: >-
            A shared secret. Cartesia returns it in the `X-Webhook-Secret`
            header on every delivery so your endpoint can verify the request.
        display_name:
          type: string
          description: An optional name to identify the webhook.
      required:
        - url
        - secret
    AgentWebhookResponse:
      title: AgentWebhookResponse
      type: object
      description: >-
        A webhook including its secret. The secret is only returned when the
        webhook is created.
      properties:
        id:
          type: string
          description: The ID of the webhook.
        url:
          type: string
          format: uri
          description: The HTTPS endpoint call events are delivered to.
        secret:
          type: string
          description: The shared secret. Returned only on creation.
        display_name:
          type: string
          nullable: true
          description: The webhook's display name, or `null` if unset.
        created_at:
          type: string
          format: date-time
          description: When the webhook was created.
        updated_at:
          type: string
          format: date-time
          description: When the webhook was last updated.
      required:
        - id
        - url
        - secret
        - created_at
        - updated_at
  securitySchemes:
    APIKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Cartesia API key (`sk_car_...`). Get one at
        [play.cartesia.ai/keys](https://play.cartesia.ai/keys).

````