---
updatedAt: 2026-04-20T23:55:58.000Z
agentTools:
  projectIndex: https://docs.onfleet.com/llms.txt
---

# Create webhook

POST Request

## Create webhook

### Body parameters

| Name                       | Type    | Description                                                                                                                                                                                                       |
| :------------------------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url                        | string  | Required. The URL that Onfleet should issue a request against as soon as the trigger condition is met. It must be HTTPS and have a valid certificate.                                                             |
| name                       | string  | Required. A name for the webhook for identification.                                                                                                                                                              |
| trigger                    | number  | Required. The number corresponding to the trigger condition on which the webhook should fire.                                                                                                                     |
| threshold                  | number  | Optional. For trigger `1`, the time threshold in seconds; for trigger `2`, the distance threshold in meters.                                                                                                      |
| canReceiveConnectionEvents | boolean | Optional. Defaults to false. This is a toggle for generating webhook payloads when another connected Org's task is in the task life cycle. This only really matters if you have a connected Onfleet organization. |

To create a new webhook, provide a verifiable `url` and `trigger`, see sidebar.

```shell Request
curl -X POST "https://onfleet.com/api/v2/webhooks" \
     -u "<your_api_key>:" \
     -d '{"url":"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger":0}'
```
```python
onfleet.webhooks.create(body={"url":"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger":0})
```
```javascript
onfleet.webhooks.create({"url":"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger":0});
```
```php
$onfleet->webhooks->create(["url"=>"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger"=>0])
```

```json Response
{
    "id": "9zqMxI79mRcHpXE111nILiPn",
    "count": 0,
    "url": "https://11ec4a02.ngrok.com/onfleet/taskStart",
    "trigger": 0
}
```
```json Error - Validation Failure
{
  "code": "InvalidContent",
  "message": {
    "error": 1008,
    "message": "The webhook URL provided did not pass our validation test.",
    "request": "0a15bc44-a39b-4040-8b48-a79295642e12"
  }
}
```

As previously mentioned, you will need to respond to our validation request with the `check` query parameter value, as a simple string response in order to avoid validation failures. This applies if you're not using the automatic validation from `Zapier`.