---
title: "Creates a webhook endpoint and answers its signing secret, which no read answers again. Its events need the read scopes their payloads carry."
---

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

Path: Sherpo merchant API › organization

`POST /v1/stores/{store}/webhooks`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `organization:write`

## Path parameters

- `store` (`createWebhook.path.store`; string, required) — The store's id.

## Request body

_Required._

- `url` (`createWebhook.url`; string, required) — An `https` URL on a public host; redirects are never followed.
  - minLength 1; maxLength 2048
- `events` (`createWebhook.events`; array<string>, required) — The events it is sent.
  - one of `"products.unlocked"`, `"request.received"`, `"request.waitlisted"`, `"request.approved"`, `"request.declined"`, `"request.expired"`, `"request.payment_due"`, `"discounts.unlocked"`, `"refund.processed"`, `"affiliate.earned"`, `"subscription.created"`, `"subscription.renewed"`, `"subscription.reminder"`, `"subscription.plan_changed"`, `"subscription.payment_failed"`, `"subscription.past_due"`, `"subscription.unpaid"`, `"subscription.canceled"`, `"subscription.reactivated"`, `"event.registered"`, `"event.updated"`, `"event.canceled"`, `"event.purchase_canceled"`, `"event.refund_failed"`, `"access.revoked"`, `"order.created"`, `"order.refunded"`, `"review.created"`, `"grant.revoked"`, `"certificate.issued"`, `"license.issued"`, `"license.disabled"`, `"license.enabled"`, `"license.replaced"`, `"license.activated"`, `"license.deactivated"`, `"license.limit_reached"`, `"customer.created"`
- `description` (`createWebhook.description`; any of, optional)
  - any of: `string`, `null`
- `enabled` (`createWebhook.enabled`; boolean, optional)

## Example request

```json
{
  "url": "string",
  "events": [
    "products.unlocked"
  ],
  "description": "string",
  "enabled": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/webhooks' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "string",
  "events": [
    "products.unlocked"
  ],
  "description": "string",
  "enabled": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/webhooks';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    url: 'string',
    events: ['products.unlocked'],
    description: 'string',
    enabled: true
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/webhooks"

payload = {
    "url": "string",
    "events": ["products.unlocked"],
    "description": "string",
    "enabled": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

Creates a webhook endpoint and answers its signing secret, which no read answers again. Its events need the read scopes their payloads carry.

#### Example

```json
{
  "webhook": {
    "id": "string",
    "url": "string",
    "description": "string",
    "events": [
      "string"
    ],
    "enabled": true,
    "connection_ended_at": "string",
    "created_at": "string",
    "updated_at": "string"
  },
  "secret": "string"
}
```

- `webhook` (`createWebhook.response.201.webhook`; object, required)
  - `id` (`createWebhook.response.201.webhook.id`; string, required)
  - `url` (`createWebhook.response.201.webhook.url`; string, required)
  - `description` (`createWebhook.response.201.webhook.description`; any of, required)
    - any of: `string`, `null`
  - `events` (`createWebhook.response.201.webhook.events`; array<string>, required)
  - `enabled` (`createWebhook.response.201.webhook.enabled`; boolean, required)
  - `connection_ended_at` (`createWebhook.response.201.webhook.connection_ended_at`; any of, required) — When it was turned off because the connection that set it up ended.
    - any of: `string`, `null`
  - `created_at` (`createWebhook.response.201.webhook.created_at`; string, required)
  - `updated_at` (`createWebhook.response.201.webhook.updated_at`; string, required)
- `secret` (`createWebhook.response.201.secret`; string, required)

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`createWebhook.response.default.type`; string, required)
  - format `uri`
- `title` (`createWebhook.response.default.title`; string, required)
- `status` (`createWebhook.response.default.status`; integer, required)
- `detail` (`createWebhook.response.default.detail`; string, required)
- `code` (`createWebhook.response.default.code`; string, optional)
- `context` (`createWebhook.response.default.context`; object, optional)
- `reached_core` (`createWebhook.response.default.reached_core`; boolean, optional)
- `core_answer` (`createWebhook.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/create-webhook/index.md
