---
title: "createWebhook"
---

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

# createWebhook

Path: agenthold API › triggers

`POST /agents/{agentId}/webhooks`

URL: `/api/v1/agents/{agentId}/webhooks`

Agent admin. The URL is shown once; deliveries prompt the webhook's session as you.

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `agentId` (`createWebhook.path.agentId`; string, required)

## Request body

_Required._

- `name` (`createWebhook.name`; string, required)
  - maxLength: `100` · minLength: `1`
- `promptTemplate` (`createWebhook.promptTemplate`; string, required) — {{payload}} marks where the delimited request body goes; otherwise it is appended.
  - minLength: `1`
- `signingSecret` (`createWebhook.signingSecret`; string, optional) — Set to require HMAC-SHA256 signatures; "" removes it; omit to keep.
- `signatureHeader` (`createWebhook.signatureHeader`; string, optional) — Header holding the signature. Default X-Hub-Signature-256.
- `enabled` (`createWebhook.enabled`; boolean, optional)

## Example request

```json
{
  "name": "string",
  "promptTemplate": "string",
  "signingSecret": "string",
  "signatureHeader": "string",
  "enabled": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/api/v1/agents/<agentId>/webhooks' \
  --header 'Content-Type: application/json' \
  --cookie 'agenthold_session=<agenthold_session>' \
  --data '
{
  "name": "string",
  "promptTemplate": "string",
  "signingSecret": "string",
  "signatureHeader": "string",
  "enabled": true
}
'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/agents/<agentId>/webhooks';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    cookie: 'agenthold_session=<agenthold_session>'
  },
  body: JSON.stringify({
    name: 'string',
    promptTemplate: 'string',
    signingSecret: 'string',
    signatureHeader: '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 = "<base-url>/api/v1/agents/<agentId>/webhooks"

payload = {
    "name": "string",
    "promptTemplate": "string",
    "signingSecret": "string",
    "signatureHeader": "string",
    "enabled": True
}
headers = {
    "cookie": "agenthold_session=<agenthold_session>",
    "Content-Type": "application/json"
}

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

print(response.text)
```

## Responses

### 201

Created.

#### Example

```json
{
  "id": "string",
  "agentId": "string",
  "sessionId": "string",
  "name": "string",
  "promptTemplate": "string",
  "signed": true,
  "signatureHeader": "string",
  "enabled": true,
  "createdBy": {
    "id": "string",
    "email": "string",
    "name": "string",
    "avatarUrl": "string"
  },
  "lastDeliveryAt": "2019-08-24T14:15:22Z",
  "lastError": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "url": "string"
}
```

- `id` (`createWebhook.response.201.id`; string, required)
- `agentId` (`createWebhook.response.201.agentId`; string, required)
- `sessionId` (`createWebhook.response.201.sessionId`; string, required)
- `name` (`createWebhook.response.201.name`; string, required)
- `promptTemplate` (`createWebhook.response.201.promptTemplate`; string, required)
- `signed` (`createWebhook.response.201.signed`; boolean, required)
- `signatureHeader` (`createWebhook.response.201.signatureHeader`; string, required)
- `enabled` (`createWebhook.response.201.enabled`; boolean, required)
- `createdBy` (`createWebhook.response.201.createdBy`; object, required)
  - `id` (`createWebhook.response.201.createdBy.id`; string, required)
  - `email` (`createWebhook.response.201.createdBy.email`; string, required)
  - `name` (`createWebhook.response.201.createdBy.name`; string, required)
  - `avatarUrl` (`createWebhook.response.201.createdBy.avatarUrl`; string, required)
- `lastError` (`createWebhook.response.201.lastError`; string, required)
- `createdAt` (`createWebhook.response.201.createdAt`; string, required)
  - format: `date-time`
- `url` (`createWebhook.response.201.url`; string, required) — The secret delivery URL. Shown once.
- `lastDeliveryAt` (`createWebhook.response.201.lastDeliveryAt`; string, optional)
  - format: `date-time`

### 400

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`createWebhook.response.400.error`; string, required)

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`createWebhook.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`createWebhook.response.404.error`; string, required)


Source: https://agenthold.dev/api/create-webhook/index.md
