---
title: Create Webhook Subscription | API Docs
---

POST

/api/partner/v2/webhook\_subscriptions

Select code sample cURL (shell:curl)

```
const url = 'https://api.linqapp.com/api/partner/v2/webhook_subscriptions';
const options = {
  method: 'POST',
  headers: {
    'X-LINQ-INTEGRATION-TOKEN': '<X-LINQ-INTEGRATION-TOKEN>',
    'Content-Type': 'application/json'
  },
  body: '{"webhook_subscription":{"webhook_url":"https://example.com/webhooks/linq","version":2,"secret":"your-webhook-secret-key","active":true,"events":["message.sent","message.received"]}}'
};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```
curl --request POST \
  --url https://api.linqapp.com/api/partner/v2/webhook_subscriptions \
  --header 'Content-Type: application/json' \
  --header 'X-LINQ-INTEGRATION-TOKEN: <X-LINQ-INTEGRATION-TOKEN>' \
  --data '{ "webhook_subscription": { "webhook_url": "https://example.com/webhooks/linq", "version": 2, "secret": "your-webhook-secret-key", "active": true, "events": [ "message.sent", "message.received" ] } }'
```

- Production server api.linqapp.com/api/partner/v2/webhook\_subscriptions

Creates a new webhook subscription for specific event types.

**Note:** Creating multiple webhook subscriptions with the same URL and events will result in duplicate webhook deliveries for those events. Ensure you don’t create duplicate subscriptions unless intentional.

## Authorizations

- **[ApiKeyAuth](/v2/api/#apikeyauth/index.md)**

## Request Body required

Media type application/json

object

**webhook\_subscription**

required

object

**webhook\_url**

required

string

##### Example

```
https://example.com/webhooks/linq
```

**version**

required

API version (should be 2 for v2)

integer

##### Example

```
2
```

**secret**

Secret key for webhook signature verification

string

##### Example

```
your-webhook-secret-key
```

**active**

Whether the webhook subscription is active

boolean

##### Example

```
true
```

**events**

required

Array\<string>

Allowed values: message.sent message.received message.read call.completed reaction.sent reaction.received typing\_indicator.received typing\_indicator.removed chat.created contact.created contact.updated contact.deleted participant.added participant.removed

##### Example

```
[
  "message.sent",
  "message.received"
]
```

## Responses

### 201

Webhook subscription created successfully

Media type application/json

object

**webhook\_subscription**

object

**id**

integer

**webhook\_url**

string

**version**

API version of the webhook subscription

integer

**events**

Array\<string>

**active**

boolean

**secret\_configured**

Whether a secret has been configured for this webhook (the actual secret is never returned)

boolean

**last\_delivered\_at**

Timestamp of the last successful webhook delivery

string format: date-time

nullable

**delivery\_attempts**

Total number of delivery attempts for this webhook

integer

**created\_at**

string format: date-time

**updated\_at**

string format: date-time

##### Example

```
{
  "webhook_subscription": {
    "id": 123,
    "webhook_url": "https://webhook.example.com/linq",
    "version": 2,
    "events": [
      "message.sent",
      "message.received",
      "call.completed"
    ],
    "active": true,
    "secret_configured": true,
    "last_delivered_at": "2024-01-15T10:30:00Z",
    "delivery_attempts": 42
  }
}
```
