# Car Job Webhook Event Reference

*Enable Car Job webhook events and reference the in-game events included in their payloads.*

Car Jobs use your existing TrackSim webhook configuration.

## Enable Car Job webhook events

Edit an existing webhook in the TrackSim Portal and enable the events you want to receive:

- **Car Jobs Delivered**
- **Car Job Cancelled**

The top-level `type` can only be `car_job.delivered` or `car_job.cancelled`.

The nested `events` array is separate from the webhook type. It uses the shared event envelope, while Car Job lifecycle entries such as `car_job.started` and `car_job.delivered` have the Car-specific metadata documented below.

Ferry and Train events are not emitted for Car Jobs and are not part of this reference.

## Event Payload

Payloads for events triggered in-game.

```json
{
  "location": {
    "x": -104003.5436,
    "y": 11.0771,
    "z": 17014.155
  },
  "real_time": "2023-03-01T00:36:12Z",
  "time": 1677630973,
  "type": "car_job.started",
  "meta": {
    "market": "quick_job"
  }
}
```

## Event types

### Car Job Started
**Type:** `car_job.started`

This event is recorded when a Car Job starts.

**Meta example**

```json
{
  "market": "quick_job"
}
```

**Meta Properties**

| Property | Type | Description |
|----------|------|-------------|
| market | `string` | The Car Job market, for example `quick_job`. |

### Car Job Delivered
**Type:** `car_job.delivered`

This event is recorded when a Car Job is delivered.

**Meta example**

```json
{
  "cargo.damage": 0.0,
  "delivery.time": 5904,
  "distance.km": 39,
  "revenue": 248,
  "vehicle.damage": 0.00008230996900238097
}
```

**Meta Properties**

| Property | Type | Description |
|----------|------|-------------|
| cargo.damage | `float` | Cargo damage recorded when the Car Job was delivered. |
| delivery.time | `int` | Delivery time recorded for the completed Car Job. |
| distance.km | `int` | Distance travelled in kilometres. |
| revenue | `int` | Revenue awarded for the Car Job. |
| vehicle.damage | `float` | Vehicle damage recorded when the Car Job was delivered. |

### Job Cancelled
**Type:** `car_job.cancelled`
This event is triggered when the job is cancelled.

**Meta Properties**

| Property  | Type    | Description                      |
|-----------|---------|----------------------------------|
| penalty   | `int`   | Penalty cost from cancelling the job. A default value of 0 will be applied if there is no penalty or the game does not provide one, rather than omitting the value. | 

### Fine
**Type:** `fine`
This event is triggered when the fine is issued.

**Meta Properties**

| Property  | Type      | Description                        |
|-----------|-----------|------------------------------------|
| offence   | `string`  | The offence committed              |
| amount    | `int`     | The fee amount in Euros or Dollars |


If the fine offence was a `speeding_camera`:

| Property    | Type  | Description         |
|-------------|-------|---------------------|
| speed_limit | `int` | speed limit in km/h |
| amount      | `int` | speed in km/h       |

### Tollgate
**Type:** `tollgate`
This event is triggered when a tollgate is used.

**Meta Properties**

| Property | Type     | Description     |
|----------| -------- |-----------------|
| cost     | `int` | Cost to go through tollgate in Euros or Dollars |

### Collision
**Type:** `collision`
This event is triggered when a driver causes a collision

**Meta Properties**

| Property          | Type     | Description               |
|-------------------|----------|---------------------------|
| wear_engine       | `int`    | Truck Engine Damage (%)   | 
| wear_chassis      | `string` | Truck Chassis Damage (%)      |
| wear_transmission | `string` | Truck Transmission Damage (%) |
| wear_cabin        | `string` | Truck Cabin damage (%)        |
| wear_wheels       | `string` | Truck wheel damage (%)        |

### Repair
**Type:** `repair`
This event is triggered when truck is repaired.

**Meta Properties**
No Metadata available

### Refuel
**Type:** `refuel`
This event is triggered when the truck is refueled.

**Meta Properties**

| Property | Type    | Description                        |
|----------| ------- |------------------------------------|
| amount   | `int`   | The fee amount in Euros or Dollars |

### Teleport
**Type:** `teleport`
This event is triggered when a teleport is detected.

**Meta Properties**

| Property | Type    | Description     |
|----------|---------|-----------------|
| from_x   | `float` | The original location in-game on the X-Axis. |
| from_y   | `float` | The original location in-game on the Y-Axis. |
| from_z   | `float` | The original location in-game on the Z-Axis. |
| to_x   | `float` | The new location in-game on the X-Axis. |
| to_y   | `float` | The new location in-game on the Y-Axis. |
| to_z   | `float` | The new location in-game on the Z-Axis. |

### Speeding
**Type:** `speeding`
This event is triggered when a driver is detected speeding.

**Meta Properties**

| Property    | Type    | Description                                  |
|-------------|---------|----------------------------------------------|
| speed_limit | `int`   | In game limit in km/h                        |
| speed       | `float` | In game limit in km/h                        |
| from_x      | `float` | The original location in-game on the X-Axis. |
| from_y      | `float` | The original location in-game on the Y-Axis. |
| from_z      | `float` | The original location in-game on the Z-Axis. |
| to_x        | `float` | The new location in-game on the X-Axis.      |
| to_y        | `float` | The new location in-game on the Y-Axis.      |
| to_z        | `float` | The new location in-game on the Z-Axis.      |
