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

# Create webhook

> Register a new external HTTPS webhook listener and generate a unique signing secret

Register a new webhook subscription to receive real-time HTTP POST notifications. Each subscription generates a cryptographically secure `secret` used to verify webhook signatures.

***

### Authentication

This endpoint requires Bearer token authentication.

```http theme={null}
Authorization: Bearer <token>
```

| Header          | Type     | Required | Description                                     | Format           |
| :-------------- | :------- | :------- | :---------------------------------------------- | :--------------- |
| `Authorization` | `string` | **Yes**  | Scoped organization API key or Bearer JWT token | `Bearer <token>` |

***

### Input parameters

The following parameters are accepted in the JSON request body.

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication. Format: `Bearer <token>`.
</ParamField>

<ParamField body="url" type="string" required>
  Your server's HTTPS callback URL. Must begin with `http://` or `https://`. Example: `https://example.com/api/webhooks/sayvy`.
</ParamField>

<ParamField body="events" type="string[]" required>
  Array of event topics to subscribe to. Must contain at least one valid event name (e.g. `["call.completed", "message.received", "campaign.completed"]`).

  <Expandable title="Allowed event names">
    * `message.received`, `message.sent`, `message.failed`
    * `conversation.started`, `conversation.closed`
    * `lead.created`, `lead.updated`
    * `ticket.created`, `ticket.assigned`, `ticket.resolved`
    * `ai.reply.generated`, `ai.tool.executed`, `agent.handoff`
    * `call.started`, `call.completed`
    * `campaign.started`, `campaign.completed`, `campaign.message.delivered`, `campaign.message.failed`
  </Expandable>
</ParamField>

***

### Response Fields

<ResponseField name="id" type="string">
  Generated UUID identifier of the webhook subscription.
</ResponseField>

<ResponseField name="organization_id" type="string">
  UUID of the organization owning the subscription.
</ResponseField>

<ResponseField name="url" type="string">
  Configured callback URL.
</ResponseField>

<ResponseField name="secret" type="string">
  HMAC SHA-256 signing secret key used to verify the `X-Sayvy-Signature` header.
</ResponseField>

<ResponseField name="events" type="string[]">
  Array of subscribed event types.
</ResponseField>

<ResponseField name="is_active" type="boolean">
  Operational state of the subscription (initially `true`).
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 creation timestamp.
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 modification timestamp.
</ResponseField>

***

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.sayvy.ai/api/v1/webhooks" \
    -H "Authorization: Bearer <token>" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://example.com/api/webhooks/sayvy",
      "events": [
        "call.completed",
        "message.received",
        "campaign.completed"
      ]
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.sayvy.ai/api/v1/webhooks"

  payload = {
      "url": "https://example.com/api/webhooks/sayvy",
      "events": [
          "call.completed",
          "message.received",
          "campaign.completed"
      ]
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.status_code)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.sayvy.ai/api/v1/webhooks", {
    method: "POST",
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      url: "https://example.com/api/webhooks/sayvy",
      events: ["call.completed", "message.received"]
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```java Java theme={null}
  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.sayvy.ai/api/v1/webhooks"))
      .header("Authorization", "Bearer <token>")
      .header("Content-Type", "application/json")
      .POST(HttpRequest.BodyPublishers.ofString("""
        {
          "url": "https://example.com/api/webhooks/sayvy",
          "events": ["call.completed", "message.received"]
        }
      """))
      .build();

  HttpResponse<String> response =
      HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "id": "8f3b0e2a-71d3-4a5f-9e6b-123456789abc",
    "organization_id": "93f35dc2-5d46-4e58-a9ee-038c35d9bcf1",
    "url": "https://example.com/api/webhooks/sayvy",
    "secret": "whsec_3b9f8a12e4c7d018b249aef567890123",
    "events": [
      "call.completed",
      "message.received",
      "campaign.completed"
    ],
    "is_active": true,
    "created_at": "2026-09-07T12:30:00Z",
    "updated_at": "2026-09-07T12:30:00Z"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "detail": "Invalid events specified: foo.bar. Allowed events: call.started, call.completed..."
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "detail": "Unauthorized"
  }
  ```
</ResponseExample>

***

<div
  style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
backgroundColor: "rgba(255, 255, 255, 0.03)",
border: "1px solid rgba(255, 255, 255, 0.08)",
borderRadius: "16px",
padding: "10px 18px",
marginTop: "40px",
gap: "16px",
flexWrap: "wrap"
}}
>
  <a
    href="/api-reference/webhooks/overview"
    style={{
display: "inline-flex",
alignItems: "center",
gap: "6px",
color: "#94A3B8",
textDecoration: "none",
fontSize: "14px",
fontWeight: "500",
padding: "4px 8px"
}}
  >
    <span style={{ fontSize: "16px" }}>‹</span> Previous
  </a>

  <div
    style={{
display: "flex",
alignItems: "center",
gap: "16px",
backgroundColor: "rgba(255, 255, 255, 0.04)",
border: "1px solid rgba(255, 255, 255, 0.06)",
borderRadius: "12px",
padding: "8px 16px",
marginLeft: "auto"
}}
  >
    <div style={{ textAlign: "right" }}>
      <div style={{ fontSize: "13px", fontWeight: "700", color: "#F8FAFC" }}>List webhooks</div>

      <div style={{ fontSize: "11px", color: "#94A3B8", maxWidth: "260px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
        GET /api/v1/webhooks
      </div>
    </div>

    <div style={{ width: "1px", height: "24px", backgroundColor: "rgba(255, 255, 255, 0.1)" }} />

    <a
      href="/api-reference/webhooks/list-webhooks"
      style={{
  display: "inline-flex",
  alignItems: "center",
  gap: "6px",
  color: "#94A3B8",
  textDecoration: "none",
  fontSize: "14px",
  fontWeight: "500"
}}
    >
      Next <span style={{ fontSize: "16px" }}>›</span>
    </a>
  </div>
</div>
