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

# Create endpoint

POST https://api.fleetwire.io/api/v2/webhooks
Content-Type: application/json

**Scope:** `webhooks:write`

Registers a URL to receive events. The response includes `signing_secret` — **this is the only time it is shown**, so store it to verify deliveries.

- `url` (string, required) — public `https://` URL
- `events` (array, required) — event names from `GET /webhooks/events`
- `description` (string, optional)

Reference: https://docs.fleetwire.io/api-reference/webhooks/post-webhooks

## Authentication

- `Authorization` header (bearer token, required) — An API token from **Settings → API tokens** in Fleetwire, sent as `Authorization: Bearer …`. Each token carries scopes: `read` for every GET, plus write scopes such as `bookings:write`.

## Servers

- `https://api.fleetwire.io/api` (Production, default)
- `https://staging.fleetwire.io/api` (Sandbox (Partner API))

## Request

### Body (application/json)

This endpoint expects an object.

- `url` (string, required) — A public `https` URL.
- `events` (list of enum, required)
  - Allowed values: `reservation.created`, `reservation.requested`, `reservation.canceled`, `booking.updated`, `booking.status_changed`, `trip.started`, `trip.ended`, `payment.processed`, `payment.failed`, `payment.refunded`, `customer.created`, `customer.updated`
- `description` (string, optional, nullable)
- `status` (enum, optional)
  - Allowed values: `enabled`, `disabled`

## Response

### 201

Created

- `id` (string, optional)
- `url` (string, optional)
- `description` (string, optional)
- `status` (string, optional)
- `type` (string, optional)
- `events` (list of string, optional)
- `created_at` (string, optional)
- `updated_at` (string, optional)
- `signing_secret` (string, optional)

## Errors

### 401 Unauthorized Error

Missing or invalid token.

- `message` (string, required)

### 403 Forbidden Error

The token doesn't carry the scope this needs, or the plan doesn't include API access.

- `message` (string, required)

### 422 Unprocessable Entity Error

The request is invalid.

- `message` (string, required)
- `errors` (map from string to list of string, required) — Each invalid field with its problems.

### 429 Too Many Requests Error

Too many requests. Wait for the `Retry-After` header (seconds).

- `message` (string, required)

## Examples

### Created

**Response**

```json
{
  "id": "00000000-0000-4000-8000-000000000501",
  "url": "https://example.com/fleetwire-webhooks",
  "description": "Toll sync",
  "status": "enabled",
  "type": "custom",
  "events": [
    "trip.started",
    "trip.ended"
  ],
  "created_at": "2026-11-01T15:00:00+00:00",
  "updated_at": "2026-11-01T15:00:00+00:00",
  "signing_secret": "whsec_EXAMPLEEXAMPLEEXAMPLEEXAMPLE0000"
}
```

**SDK Code**

```python Created
import requests

url = "https://api.fleetwire.io/api/v2/webhooks"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript Created
const url = 'https://api.fleetwire.io/api/v2/webhooks';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go Created
package main

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

func main() {

	url := "https://api.fleetwire.io/api/v2/webhooks"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://api.fleetwire.io/api/v2/webhooks")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.post("https://api.fleetwire.io/api/v2/webhooks")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fleetwire.io/api/v2/webhooks', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Created
using RestSharp;

var client = new RestClient("https://api.fleetwire.io/api/v2/webhooks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Created
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fleetwire.io/api/v2/webhooks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Webhooks_postWebhooks_example

**Request**

```json
{
  "url": "https://example.com/fleetwire-webhooks",
  "events": [
    "trip.started",
    "trip.ended"
  ],
  "description": "Toll sync"
}
```

**Response**

```json
{
  "id": "00000000-0000-4000-8000-000000000501",
  "url": "https://example.com/fleetwire-webhooks",
  "description": "Toll sync",
  "status": "enabled",
  "type": "custom",
  "events": [
    "trip.started",
    "trip.ended"
  ],
  "created_at": "2026-11-01T15:00:00+00:00",
  "updated_at": "2026-11-01T15:00:00+00:00",
  "signing_secret": "whsec_EXAMPLEEXAMPLEEXAMPLEEXAMPLE0000"
}
```

**SDK Code**

```python Webhooks_postWebhooks_example
import requests

url = "https://api.fleetwire.io/api/v2/webhooks"

payload = {
    "url": "https://example.com/fleetwire-webhooks",
    "events": ["trip.started", "trip.ended"],
    "description": "Toll sync"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Webhooks_postWebhooks_example
const url = 'https://api.fleetwire.io/api/v2/webhooks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"url":"https://example.com/fleetwire-webhooks","events":["trip.started","trip.ended"],"description":"Toll sync"}'
};

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

```go Webhooks_postWebhooks_example
package main

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

func main() {

	url := "https://api.fleetwire.io/api/v2/webhooks"

	payload := strings.NewReader("{\n  \"url\": \"https://example.com/fleetwire-webhooks\",\n  \"events\": [\n    \"trip.started\",\n    \"trip.ended\"\n  ],\n  \"description\": \"Toll sync\"\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 Webhooks_postWebhooks_example
require 'uri'
require 'net/http'

url = URI("https://api.fleetwire.io/api/v2/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\": \"https://example.com/fleetwire-webhooks\",\n  \"events\": [\n    \"trip.started\",\n    \"trip.ended\"\n  ],\n  \"description\": \"Toll sync\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.fleetwire.io/api/v2/webhooks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"https://example.com/fleetwire-webhooks\",\n  \"events\": [\n    \"trip.started\",\n    \"trip.ended\"\n  ],\n  \"description\": \"Toll sync\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fleetwire.io/api/v2/webhooks', [
  'body' => '{
  "url": "https://example.com/fleetwire-webhooks",
  "events": [
    "trip.started",
    "trip.ended"
  ],
  "description": "Toll sync"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Webhooks_postWebhooks_example
using RestSharp;

var client = new RestClient("https://api.fleetwire.io/api/v2/webhooks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"url\": \"https://example.com/fleetwire-webhooks\",\n  \"events\": [\n    \"trip.started\",\n    \"trip.ended\"\n  ],\n  \"description\": \"Toll sync\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Webhooks_postWebhooks_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "url": "https://example.com/fleetwire-webhooks",
  "events": ["trip.started", "trip.ended"],
  "description": "Toll sync"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fleetwire.io/api/v2/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()
```