> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://catena.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://catena.ferndocs.com/_mcp/server.

# Create Webhook Subscription

POST https://api.catenatelematics.com/v2/notifications/webhooks
Content-Type: application/json

Create a new webhook subscription.

Reference: https://catena.ferndocs.com/api-reference/notifications/webhook-subscriptions/create-webhook-subscription

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a WebhookCreate.

- `url` (string, required) — The target URL of the webhook
- `event_name` (WebhookCreateEventName, required) — The event name that triggers the webhook
- `filters` (WebhookFilters, optional, nullable) — Webhook filters
- `secret` (string, optional, nullable) — The secret used to sign messages

## Response

### 200

Successful Response

- `webhooks_createSubscription_Response_200`
  - Webhook: Webhook
  - list of Webhook

## Errors

### 400 Bad Request Error

Bad Request

- `code` (integer, optional, default: 400)
- `message` (string, optional, default: Bad Request)
- `detail` (string, optional, nullable)

### 401 Unauthorized Error

Unauthorized

- `code` (integer, optional, default: 401)
- `message` (string, optional, default: Unauthorized)
- `detail` (string, optional, nullable)

### 403 Forbidden Error

Forbidden

- `code` (integer, optional, default: 403)
- `message` (string, optional, default: Forbidden)
- `detail` (string, optional, nullable)

### 404 Not Found Error

Not Found

- `code` (integer, optional, default: 404)
- `message` (string, optional, default: Not Found)
- `detail` (string, optional, nullable)

### 405 Method Not Allowed Error

Method Not Allowed

- `code` (integer, optional, default: 405)
- `message` (string, optional, default: Method Not Allowed)
- `detail` (string, optional, nullable)

### 409 Conflict Error

Conflict

- `code` (integer, optional, default: 409)
- `message` (string, optional, default: Conflict)
- `detail` (string, optional, nullable)

### 422 Unprocessable Entity Error

Unprocessable Entity

- `code` (integer, optional, default: 422)
- `message` (string, optional, default: Invalid Request Body)
- `detail` (list of ValidationErrorDetail, optional, nullable)

### 429 Too Many Requests Error

Too Many Requests

- `code` (integer, optional, default: 429)
- `message` (string, optional, default: Too Many Requests)
- `detail` (RetryAfterDetail, optional, nullable)

### 500 Internal Server Error

Internal Server Error

- `message` (string, optional, default: Internal Server Error)

## Types

### WebhookCreateEventName

The event name that triggers the webhook

- WebhookEventNameEnum: enum
  - Allowed values: `document.added`, `document.modified`, `document.*`, `dvir_log.added`, `dvir_log.modified`, `dvir_log.removed`, `dvir_log.*`, `driver_safety_event.added`, `driver_safety_event.modified`, `driver_safety_event.removed`, `driver_safety_event.*`, `driver_vehicle_association.added`, `driver_vehicle_association.modified`, `driver_vehicle_association.*`, `trailer_vehicle_association.added`, `trailer_vehicle_association.modified`, `trailer_vehicle_association.*`, `invitation.created`, `invitation.rejected`, `invitation.declined`, `invitation.viewed`, `invitation.sent`, `invitation.accepted`, `invitation.expired`, `invitation.deleted`, `invitation.*`, `connection.created`, `connection.staled`, `connection.*`, `fleet_connection.created`, `fleet_connection.*`, `fleet_info.added`, `fleet_info.modified`, `fleet_info.removed`, `fleet_info.*`, `share_agreement.created`, `share_agreement.updated`, `share_agreement.deleted`, `share_agreement.*`, `webhook.created`, `webhook.updated`, `webhook.deleted`, `webhook.staled`, `webhook.activated`, `webhook.paused`, `webhook.*`, `workflow.added`, `workflow.modified`, `workflow.removed`, `workflow.*`, `tsp.created`, `tsp.requested`, `vehicle.added`, `vehicle.modified`, `vehicle.removed`, `vehicle.*`, `trailer.added`, `trailer.modified`, `trailer.removed`, `trailer.*`, `trailer_location.added`, `trailer_location.modified`, `trailer_location.*`, `trailer_status.added`, `trailer_status.modified`, `trailer_status.*`, `execution.created`, `execution.staled`, `execution.failed`, `execution.*`, `schedule.deactivated`, `schedule.*`, `user.added`, `user.modified`, `user.removed`, `user.*`, `vehicle_location.added`, `vehicle_location.*`, `ifta_summary.added`, `ifta_summary.modified`, `ifta_summary.removed`, `ifta_summary.*`, `hos_availability.added`, `hos_availability.modified`, `hos_availability.removed`, `hos_availability.*`, `hos_daily_log.added`, `hos_daily_log.modified`, `hos_daily_log.*`, `hos_daily_snapshot.added`, `hos_daily_snapshot.modified`, `hos_daily_snapshot.removed`, `hos_daily_snapshot.*`, `hos_event.added`, `hos_event.modified`, `hos_event.removed`, `hos_event.*`, `hos_violation.added`, `hos_violation.modified`, `hos_violation.removed`, `hos_violation.*`, `engine_log.added`, `engine_log.modified`, `engine_log.removed`, `engine_log.*`, `engine_status.added`, `engine_status.modified`, `engine_status.*`, `group_message.added`, `group_message.modified`, `group_message.*`, `message.added`, `message.modified`, `message.*`, `fuel_transaction.added`, `fuel_transaction.modified`, `fuel_transaction.*`, `geofence_monitor.created`, `geofence_monitor.departed`, `geofence_monitor.arrived`, `geofence_monitor.completed`, `geofence_monitor.cancelled`, `geofence_monitor.expired`, `geofence_monitor.*`, `resource_operation.created`, `resource_operation.succeeded`, `resource_operation.failed`, `resource_operation.*`
- WebhookCatchAllEvents: enum
  - Allowed values: `dvir_log.*`, `driver_safety_event.*`, `driver_vehicle_association.*`, `trailer_vehicle_association.*`, `invitation.*`, `connection.*`, `fleet_connection.*`, `fleet_info.*`, `share_agreement.*`, `webhook.*`, `vehicle.*`, `trailer.*`, `trailer_location.*`, `trailer_status.*`, `user.*`, `vehicle_location.*`, `ifta_summary.*`, `hos_availability.*`, `hos_daily_snapshot.*`, `hos_event.*`, `hos_violation.*`, `engine_log.*`, `engine_status.*`, `group_message.*`, `message.*`, `fuel_transaction.*`, `geofence_monitor.*`, `resource_operation.*`, `workflow.*`

### WebhookFilters

Webhook filters

- `fleet_ids` (list of string, optional, nullable) — Filter by the IDs of the fleets
- `fleet_refs` (list of string, optional, nullable) — Filter by the references of the fleets. The reference is the ID of the fleet in the partner's system.
- `content` (map from string to list of string, optional, nullable) — Filter delivered records by their content. Each key is a field in the event record mapped to a list of accepted values: a record matches a key if that field equals any one of the listed values (OR within a key), and all keys must match (AND across keys). A record is delivered only if every key matches; records missing a filtered key are not delivered, and a key mapped to an empty list imposes no constraint. If no records in an event match, nothing is sent. Values are compared as strings.

### Webhook

Webhook model

- `url` (string, required) — The target URL of the webhook
- `partner_id` (string, required) — The ID of the partner that owns the webhook
- `event_name` (enum, required) — The event name that triggers the webhook
  - Allowed values: `document.added`, `document.modified`, `document.*`, `dvir_log.added`, `dvir_log.modified`, `dvir_log.removed`, `dvir_log.*`, `driver_safety_event.added`, `driver_safety_event.modified`, `driver_safety_event.removed`, `driver_safety_event.*`, `driver_vehicle_association.added`, `driver_vehicle_association.modified`, `driver_vehicle_association.*`, `trailer_vehicle_association.added`, `trailer_vehicle_association.modified`, `trailer_vehicle_association.*`, `invitation.created`, `invitation.rejected`, `invitation.declined`, `invitation.viewed`, `invitation.sent`, `invitation.accepted`, `invitation.expired`, `invitation.deleted`, `invitation.*`, `connection.created`, `connection.staled`, `connection.*`, `fleet_connection.created`, `fleet_connection.*`, `fleet_info.added`, `fleet_info.modified`, `fleet_info.removed`, `fleet_info.*`, `share_agreement.created`, `share_agreement.updated`, `share_agreement.deleted`, `share_agreement.*`, `webhook.created`, `webhook.updated`, `webhook.deleted`, `webhook.staled`, `webhook.activated`, `webhook.paused`, `webhook.*`, `workflow.added`, `workflow.modified`, `workflow.removed`, `workflow.*`, `tsp.created`, `tsp.requested`, `vehicle.added`, `vehicle.modified`, `vehicle.removed`, `vehicle.*`, `trailer.added`, `trailer.modified`, `trailer.removed`, `trailer.*`, `trailer_location.added`, `trailer_location.modified`, `trailer_location.*`, `trailer_status.added`, `trailer_status.modified`, `trailer_status.*`, `execution.created`, `execution.staled`, `execution.failed`, `execution.*`, `schedule.deactivated`, `schedule.*`, `user.added`, `user.modified`, `user.removed`, `user.*`, `vehicle_location.added`, `vehicle_location.*`, `ifta_summary.added`, `ifta_summary.modified`, `ifta_summary.removed`, `ifta_summary.*`, `hos_availability.added`, `hos_availability.modified`, `hos_availability.removed`, `hos_availability.*`, `hos_daily_log.added`, `hos_daily_log.modified`, `hos_daily_log.*`, `hos_daily_snapshot.added`, `hos_daily_snapshot.modified`, `hos_daily_snapshot.removed`, `hos_daily_snapshot.*`, `hos_event.added`, `hos_event.modified`, `hos_event.removed`, `hos_event.*`, `hos_violation.added`, `hos_violation.modified`, `hos_violation.removed`, `hos_violation.*`, `engine_log.added`, `engine_log.modified`, `engine_log.removed`, `engine_log.*`, `engine_status.added`, `engine_status.modified`, `engine_status.*`, `group_message.added`, `group_message.modified`, `group_message.*`, `message.added`, `message.modified`, `message.*`, `fuel_transaction.added`, `fuel_transaction.modified`, `fuel_transaction.*`, `geofence_monitor.created`, `geofence_monitor.departed`, `geofence_monitor.arrived`, `geofence_monitor.completed`, `geofence_monitor.cancelled`, `geofence_monitor.expired`, `geofence_monitor.*`, `resource_operation.created`, `resource_operation.succeeded`, `resource_operation.failed`, `resource_operation.*`
- `filters` (WebhookFilters, optional, nullable) — The filters to apply to the webhook
- `secret` (string, optional, nullable) — The secret used to sign messages
- `created_at` (datetime, optional, nullable)
- `updated_at` (datetime, optional, nullable)
- `deleted_at` (datetime, optional, nullable)
- `id` (string, optional)
- `status` (enum, optional) — The current status of the webhook
  - Allowed values: `active`, `paused`, `stale`, `deleted`

### ValidationErrorDetail

- `path` (string, required)
- `input` (string, required)
- `message` (string, required)
- `error_type` (string, required)

### RetryAfterDetail

- `retry_after_seconds` (integer, required)
- `message` (string, required)

## Examples

**Request**

```json
{
  "url": "string",
  "event_name": "document.added",
  "filters": {
    "fleet_ids": [],
    "fleet_refs": []
  }
}
```

**Response**

```json
{
  "created_at": "2024-01-15T09:30:00Z",
  "deleted_at": "2024-01-15T09:30:00Z",
  "event_name": "document.added",
  "filters": {
    "content": {},
    "fleet_ids": [
      "string"
    ],
    "fleet_refs": [
      "string"
    ]
  },
  "id": "string",
  "partner_id": "string",
  "secret": "string",
  "status": "active",
  "updated_at": "2024-01-15T09:30:00Z",
  "url": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.catenatelematics.com/v2/notifications/webhooks"

payload = {
    "url": "string",
    "event_name": "document.added",
    "filters": {
        "fleet_ids": [],
        "fleet_refs": []
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.catenatelematics.com/v2/notifications/webhooks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"url":"string","event_name":"document.added","filters":{"fleet_ids":[],"fleet_refs":[]}}'
};

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

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.catenatelematics.com/v2/notifications/webhooks"

	payload := strings.NewReader("{\n  \"url\": \"string\",\n  \"event_name\": \"document.added\",\n  \"filters\": {\n    \"fleet_ids\": [],\n    \"fleet_refs\": []\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.catenatelematics.com/v2/notifications/webhooks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"string\",\n  \"event_name\": \"document.added\",\n  \"filters\": {\n    \"fleet_ids\": [],\n    \"fleet_refs\": []\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.catenatelematics.com/v2/notifications/webhooks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"string\",\n  \"event_name\": \"document.added\",\n  \"filters\": {\n    \"fleet_ids\": [],\n    \"fleet_refs\": []\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.catenatelematics.com/v2/notifications/webhooks', [
  'body' => '{
  "url": "string",
  "event_name": "document.added",
  "filters": {
    "fleet_ids": [],
    "fleet_refs": []
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.catenatelematics.com/v2/notifications/webhooks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"url\": \"string\",\n  \"event_name\": \"document.added\",\n  \"filters\": {\n    \"fleet_ids\": [],\n    \"fleet_refs\": []\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "url": "string",
  "event_name": "document.added",
  "filters": [
    "fleet_ids": [],
    "fleet_refs": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.catenatelematics.com/v2/notifications/webhooks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```