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

# Set Webhook

> Create or replace an agent's webhook.

The configured URL receives ALL of that agent's event types — call lifecycle
(`call.received`, `call.completed`, `call.failed`), SMS (`sms.received`),
and future events — as signed JSON POSTs. Each agent may have at most one
webhook; POSTing again replaces it.

- `agent_id`: the agent whose events this webhook receives (required).
- `secret`:   HMAC signing secret. Omit to auto-generate.

The response returns the full `secret` **once** — store it to verify the
signature header on deliveries.



## OpenAPI

````yaml /openapi.json post /v1/webhooks
openapi: 3.1.0
info:
  title: AgentLine
  description: >-
    AgentLine gives every AI agent a real phone number, a human-like voice, and
    the ability to make and receive calls and SMS autonomously. This SDK covers
    the core developer surface: agents, numbers, calls, messages, events,
    webhooks, billing, and voice.
  version: 0.3.0
  summary: Phone numbers, voice, and SMS for AI agents.
  contact:
    name: AgentLine
    url: https://agentline.cloud
  license:
    name: MIT
    url: https://opensource.org/license/mit
servers:
  - url: https://api.agentline.cloud
    description: Production
security:
  - API Key or OAuth: []
paths:
  /v1/webhooks:
    post:
      tags:
        - Webhooks
      summary: Set Webhook
      description: >-
        Create or replace an agent's webhook.


        The configured URL receives ALL of that agent's event types — call
        lifecycle

        (`call.received`, `call.completed`, `call.failed`), SMS
        (`sms.received`),

        and future events — as signed JSON POSTs. Each agent may have at most
        one

        webhook; POSTing again replaces it.


        - `agent_id`: the agent whose events this webhook receives (required).

        - `secret`:   HMAC signing secret. Omit to auto-generate.


        The response returns the full `secret` **once** — store it to verify the

        signature header on deliveries.
      operationId: set_webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookConfig'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCreated'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - API Key or OAuth: []
components:
  schemas:
    WebhookConfig:
      properties:
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
          description: >-
            HTTPS URL that will receive this agent's events as signed JSON
            POSTs. Setting this replaces any existing webhook for the agent.
        agent_id:
          type: string
          title: Agent Id
          description: >-
            ID of the agent whose events this webhook receives. Each agent may
            have at most one webhook.
        secret:
          anyOf:
            - type: string
            - type: 'null'
          title: Secret
          description: >-
            Optional HMAC signing secret. Auto-generated if omitted. Used to
            verify the signature header on delivered payloads.
        signature_header:
          anyOf:
            - type: string
            - type: 'null'
          title: Signature Header
          description: >-
            Header name for the HMAC-SHA256 signature of the raw body. Defaults
            to 'X-Webhook-Signature' (natively verified by Hermes, OpenClaw, and
            other agent platforms). Set to 'X-Hub-Signature-256' for
            GitHub-style verification, or any custom header name your platform
            expects. Omit to keep the existing value when updating.
      type: object
      required:
        - url
        - agent_id
      title: WebhookConfig
      description: Body for POST /v1/webhooks (create or replace an agent's webhook).
    WebhookCreated:
      properties:
        agent_id:
          type: string
          title: Agent Id
          description: Agent this webhook is scoped to
        url:
          type: string
          title: Url
          description: Configured webhook URL
        secret:
          type: string
          title: Secret
          description: Full signing secret. Save it now — it is masked on subsequent reads.
        signature_header:
          type: string
          title: Signature Header
          description: Header name used for HMAC-SHA256 signature delivery.
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: When the webhook was last (re)configured
      type: object
      required:
        - agent_id
        - url
        - secret
        - signature_header
      title: WebhookCreated
      description: Returned on POST — exposes the full secret this one time.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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:
    API Key or OAuth:
      type: http
      description: >-
        AgentLine API key. Get one via the email OTP flow (POST /v1/auth/otp
        then POST /v1/auth/verify). Pass as: Authorization: Bearer sk_live_...
      scheme: bearer
      bearerFormat: API key (sk_live_...)
      x-fern-bearer:
        name: apiKey
        env: AGENTLINE_API_KEY

````