﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head>---
canonical_url: "https://docs.composio.dev/reference/api-reference/webhook-subscriptions/postWebhookSubscriptions"
markdown_url: "https://docs.composio.dev/reference/api-reference/webhook-subscriptions/postWebhookSubscriptions.md"
product: "platform"
version: "3.1"
last_updated: null
---

# Create webhook subscription

**Documentation:** /reference/api-reference/webhook-subscriptions/postWebhookSubscriptions

> **API version:** This page documents Composio REST API v3.1, the current version, at `https://backend.composio.dev/api/v3.1`. `https://backend.composio.dev/api/v3` is the previous version and remains supported.

Creates a webhook subscription for the authenticated project. Only one subscription is allowed per project. The signing secret is returned in subscription responses.

---

## POST `/api/v3.1/webhook_subscriptions`

**Endpoint:** `https://backend.composio.dev/api/v3.1/webhook_subscriptions`

**Summary:** Create webhook subscription

Creates a webhook subscription for the authenticated project. Only one subscription is allowed per project. The signing secret is returned in subscription responses.

### Authentication

**ApiKeyAuth** - API Key in `header` header `x-api-key`

### Request Body

**Schema:**

- `webhook_url` (string (uri)) *(required)*: HTTPS URL to receive webhook events
- `enabled_events` (array<string>) *(required)*: Array of event types to subscribe to
- `version` (enum: "V1" | "V2" | "V3"): Webhook payload version

**Example:**

```json
{
  "webhook_url": "https://example.com",
  "enabled_events": [
    "string"
  ],
  "version": "V3"
}
```

### Responses

#### 201 - Webhook subscription created

**Response Schema:**

- `id` (string (webhookSubscriptionId)) *(required)*: Unique subscription ID
- `webhook_url` (string) *(required)*: Webhook destination URL
- `version` (enum: "V1" | "V2" | "V3") *(required)*: Webhook payload version
- `enabled_events` (array<string>) *(required)*: Subscribed event types
- `secret` (string) *(required)*: Signing secret for HMAC verification
- `created_at` (string) *(required)*: ISO 8601 timestamp
- `updated_at` (string) *(required)*: ISO 8601 timestamp

**Example Response:**

```json
{
  "id": "string",
  "webhook_url": "string",
  "version": "V1",
  "enabled_events": [
    "string"
  ],
  "secret": "string",
  "created_at": "string",
  "updated_at": "string"
}
```

#### 400 - Invalid request

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 401 - Unauthorized

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 403 - Your role does not allow modifying webhook subscriptions

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 409 - Subscription already exists

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 500 - Internal server error

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

### Example requests

Python uses `requests`; TypeScript uses Node.js fetch. Replace sample IDs and values before sending these requests.

Set `COMPOSIO_API_KEY` before running these requests.

#### Python

```python
import os
import requests
import json

response = requests.request("POST", "https://backend.composio.dev/api/v3.1/webhook_subscriptions",
    headers={"Content-Type": "application/json", "x-api-key": os.environ["COMPOSIO_API_KEY"]},
    json=json.loads("{\"webhook_url\":\"https://example.com\",\"enabled_events\":[\"string\"],\"version\":\"V3\"}"))
response.raise_for_status()
print(response.text)
```

#### TypeScript

```typescript
const response = await fetch("https://backend.composio.dev/api/v3.1/webhook_subscriptions", {
  method: "POST",
  headers: { "Content-Type": "application/json", "x-api-key": process.env["COMPOSIO_API_KEY"]! },
  body: JSON.stringify({
  "webhook_url": "https://example.com",
  "enabled_events": [
    "string"
  ],
  "version": "V3"
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.text());
```

#### API

```bash
curl -X POST "https://backend.composio.dev/api/v3.1/webhook_subscriptions" \
  -H "x-api-key: $COMPOSIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_url": "https://example.com",
    "enabled_events": [
      "string"
    ],
    "version": "V3"
  }'
```

---

## REST API version

The current REST API version is **v3.1**, served at `https://backend.composio.dev/api/v3.1`. Prefer it for new code and new examples.

`https://backend.composio.dev/api/v3` is the previous version. It is frozen with pinned tool-version defaults and remains supported — existing v3 integrations keep working and do not need to migrate.