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

# On Start Trip

> Send a webhook when a field worker starts a trip in the field app.

**On Start Trip** runs when a field worker taps **Start Trip** in the field app and the trip start is recorded. It gives you real-time visibility of when field work begins.

The event belongs to the **Location History** group. It has no task type and no rules: every trip start in your organization triggers it.

<Note>
  Required permission:

  * View automation
  * Create automation
</Note>

## Before you start

* Field workers use the field app.
* The start trip / end trip feature is turned on for your organization.
* The event can only come from the field app. Nothing in the web app starts a trip.

## Set it up

1. On **Workflow › Automation**, click **New**.

2. **Name**: for example "Notify on trip start".

3. **Event**: **On Start Trip**.

4. **Automation Type**: **Webhook**, the only type this event allows.

5. Fill in the [webhook](/pages/workflow/automation/actions/webhook) **URL** and any **Headers**, for example:

   | Setting | Example |
   | - | - |
   | URL | `https://api.example.com/trip/start` |
   | Header name | `Authorization` |
   | Header value | `Bearer your_api_token_here` |

6. Click **Submit**, make sure the automation is **Active**, and ask a field worker to start a trip to test it.

## Use cases

| Scenario | What your endpoint does |
| - | - |
| Trip start alerts | Posts to the operations team's dashboard or chat. |
| Compliance logs | Records start time, user and location in a compliance system. |
| Fleet status | Marks the field worker as "Active" in a fleet or dispatch system. |

## Webhook payload

An example request body:

```json theme={null}
{
  "event": "on_start_trip",
  "timestamp": "2024-01-15T08:30:00.000Z",
  "user": {
    "id": "user_id_123",
    "name": "Budi Santoso",
    "email": "budi@example.com",
    "phone": "+6281234567890"
  },
  "trip": {
    "startTime": "2024-01-15T08:30:00.000Z",
    "startLocation": { "latitude": -6.2088, "longitude": 106.8456, "address": "Jakarta, Indonesia" }
  },
  "hub": { "id": "hub_id_456", "name": "Jakarta Hub" }
}
```

The [automation log](/pages/workflow/automation/log) shows the exact request that was sent.

## Troubleshooting

**The automation doesn't run when a trip starts.**

* Check that its **Active** switch is on.
* Check that start trip / end trip is turned on for your organization.
* A field worker without a connection sends the trip start when they come back online.
* Look at the [log](/pages/workflow/automation/log) for failed runs and their responses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.