> This page is optimized for agents. Use the linked Markdown pages and llms.txt indexes for related API content.

# Create Webhook entity.

> Creates a new Webhook entity. The webhook receives a POST request for every subscribed event. The response contains the generated `secret` used to sign every delivery — store it to verify that deliveries come from Recranet. The URL must be https and publicly resolvable.

- Product: Webhooks
- Section: Webhook
- Snapshot: Current
- Method: `POST`
- Path: `/api/webhooks/`

## Request body

Required: yes  
Content types: `application/json`  

### `description`

Type: `string`  
Required: no  

### `url`

Type: `string`  
Required: yes  

### `events`

Type: `string[]`  
Required: no  

#### string

Type: `string`  
Allowed values: `accommodation.created`, `accommodation.updated`, `accommodation.deleted`, `accommodation_category.created`, `accommodation_category.updated`, `accommodation_category.deleted`, `accommodation_listing.created`, `accommodation_listing.updated`, `accommodation_listing.deleted`, `locality_category.created`, `locality_category.updated`, `locality_category.deleted`, `package_specification.created`, `package_specification.updated`, `package_specification.deleted`  

### `active`

Type: `boolean`  
Required: no  
Default: `true`  

## Execute with TypeScript

Package: `@recranet/sdk`  

```ts
import { RecranetApiClient } from "@recranet/sdk";

const client = new RecranetApiClient({ apiKey: process.env.RECRANET_API_KEY! });

const result = await client.webhooks.create({
  url: "<url>",
});
```

## Execute with curl

```bash
curl -X POST "https://app.recranet.com/api/webhooks/" \
    -H "X-Api-Key: $RECRANET_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{"url":"<url>"}'
```

## Responses

### Response `200`

Category: success  

Successful response

#### `application/json`

##### Generated example

```json
{
  "id": 0,
  "url": "url",
  "secret": "secret",
  "description": "description",
  "events": [],
  "active": true
}
```

##### Schema

###### Webhook

Type: `Webhook`  

###### `id`

Type: `number`  
Required: yes  

###### `description`

Type: `string`  
Required: no  

###### `url`

Type: `string`  
Required: yes  

###### `secret`

Type: `string`  
Required: yes  

###### `events`

Type: `string[]`  
Required: no  

###### string

Type: `string`  

###### `active`

Type: `boolean`  
Required: no  
Default: `true`  

### Response `400`

Category: client-error  

Bad request

#### `application/json`

##### Example

```json
{
  "statusCode": 400,
  "description": "Bad request",
  "errors": [
    "Bad request"
  ]
}
```

##### Schema

###### object

Type: `object`  

## Related representations

- [Human documentation](/webhooks/methods/create/)
- [TypeScript Markdown](/webhooks/methods/create.md?lang=typescript)
- [curl Markdown](/webhooks/methods/create.md?lang=curl)
- [site llms.txt](/llms.txt)
- [product llms.txt](/webhooks/llms.txt)
- [snapshot llms.txt](/webhooks/llms.txt)
