# Truck Job Webhook Payload Reference

*Reference the Truck Job webhook envelope, job, trailer and mod payloads.*

## Payload Structure

The following properties are returned in our payload structure:

| Property | Type        | Description |
|----------| ----------- | ----------- |
| object | `string` | We only send the object `event` at this time |
| type | `string` | Event type posted e.g. `job.delivered`, `job.cancelled` |
| data | `dict` | The data relating to the event type above. |

```json
{
  "object": "event",
  "type": "...",
  "data": {}
}
```

## Job Webhook Object

This is an example payload for the webhook events `job.delivered` and `job.cancelled`.

```json
{
  "object": {
      "id": 1,
      "object": "job",
      "driver": {
        "id": 1,
        "steam_id": "76561198171686422",
        "username": "Nathan7471",
        "profile_photo_url": "https://tracksim.app/example-profile-pic.png",
        "client": {
          "version": {
            "name": "1.0.0",
            "branch_name": "stable",
            "platform": "windows"
          }
        },
        "last_active": "2023-01-27T16:13:08Z"
      },
      "start_time": "2023-01-26T22:52:07Z",
      "stop_time": "2023-01-26T23:49:49Z",
      "time_spent": 3461,
      "planned_distance": 160,
      "driven_distance": 184,
      "adblue_used": -3,
      "fuel_used": -59.91,
      "is_special": false,
      "is_late": true,
      "market": "cargo_market",
      "cargo": {
        "unique_id": "carb_water",
        "name": "Carbonated Water",
        "mass": 24961.20,
        "damage": 0.0
      },
      "game": {
        "short_name": "eut2",
        "language": "en_gb",
        "had_police_enabled": false
      },
      "multiplayer": {
        "mode": "truckersmp",
        "meta": {
          "player_id": "241", 
          "server": "Simulation 1"
        }
      },
      "source_city": {
        "unique_id": "joetsu",
        "name": "Joetsu"
      },
      "source_company": {
        "unique_id": "dans_jardin",
        "name": "Dans le Jardin"
      },
      "destination_city": {
        "unique_id": "toyonaka",
        "name": "Toyonaka"
      },
      "destination_company": {
        "unique_id": "wilnet_trans",
        "name": "Wilnet Transport"
      },
      "truck": {
        "unique_id": "vehicle.mercedes.actros",
        "name": "Actros",
        "brand": {
          "unique_id": "mercedes",
          "name": "Mercedes-Benz"
        },
        "odometer": 528,
        "initial_odometer": 345,
        "wheel_count": 4,
        "license_plate": " 54-57",
        "license_plate_country": {
          "unique_id": "osaka",
          "name": "osaka"
        },
        "current_damage": {
          "cabin": 0.01,
          "chassis": 0.01,
          "engine": 0,
          "transmission": 0,
          "wheels": 0
        },
        "total_damage": {
          "cabin": 0.05,
          "chassis": 0.07,
          "engine": 0.03,
          "transmission": 0.02,
          "wheels": 0.02
        },
        "top_speed": 25.71,
        "average_speed": 10.71
      },
      "trailers": [
        ...
      ],
      "events": [
        ...
      ]
  }
}
```

**Properties**

| Property                              | Type       | Description                                                                             |
|---------------------------------------|------------|-----------------------------------------------------------------------------------------|
| id                                    | `int`      | TrackSim ID assigned to Job                                                             |
| object                                | `string`   | Type of object returned                                                                 |
| driver.id                             | `int`      | TrackSim assigned driver ID                                                             |
| driver.steam_id                       | `string`   | Steam 64 ID related to the driver                                                       |
| driver.username                       | `string`   | Username for driver                                                                     |
| driver.profile_photo_url              | `string`   | Profile picture for driver                                                              |
| driver.client.version.name            | `string`   | Tracker version name used to log job                                                    |
| driver.client.version.branch_name     | `string`   | Tracker version branch used to log job                                                  |
| driver.client.version.platform        | `string`   | Tracker version platform used to log job                                                |
| driver.last_active                    | `string`   | Last time the driver was active                                                         |
| start_time                            | `datetime` | Job Start time                                                                          |
| stop_time                             | `datetime` | Job End Time                                                                            |
| time_spent                            | `int`      | Time spent on job in Seconds                                                            |
| planned_distance                      | `int`      | Job planned distance in KMs                                                             |
| driven_distance                       | `int`      | Job driven distance in KMs                                                              |
| adblue_used                           | `float`    | Adblue used in litres                                                                   |
| fuel_used                             | `float`    | Fuel used in litres                                                                     |
| is_special                            | `boolean`  | If the job is a special Transport job                                                   |
| is_late                               | `boolean`  | If the job was delivered late                                                           |
| market                                | `string`   | The market the job was collected from. `cargo_market` e.g.                              |
| cargo.unique_id                       | `string`   | Cargo game unique ID                                                                    |
| cargo.name                            | `string`   | Cargo name (Can be Null)                                                                |
| cargo.mass                            | `float`    | Cargo mass in KG                                                                        |
| cargo.damage                          | `float`    | Cargo damage                                                                            |
| game.short_name                       | `string`   | Game used `ats` for American Truck Simulator & `eut2` for Euro Truck Simulator 2        |
| game.language                         | `string`   | Language returned by game (Can be Null)                                                 |
| game.had_police_enabled               | `boolean`  | if police were enabled                                                                  |
| multiplayer.mode                      | `string`   | Job multiplayer mode type e.g. `truckersmp`, `multiplayer` is Convoy Mode (Can be Null) |
| multiplayer.meta.player_id            | `string`   | Player ID if in `truckersmp` (Can be Null)                                              |
| multiplayer.meta.server               | `string`   | Player server if in `truckersmp` (Can be Null)                                          |
| source_city.unique_id                 | `string`   | Source City game unique ID                                                              |
| source_city.name                      | `string`   | Source City name (Can be Null)                                                          |
| source_company.unique_id              | `string`   | Source Company game unique ID                                                           |
| source_company.name                   | `string`   | Source Company name (Can be Null)                                                       |
| destination_city.unique_id            | `string`   | Destination City game unique ID                                                         |
| destination_city.name                 | `string`   | Destination City Name (Can be Null)                                                     |
| destination_company.unique_id         | `string`   | Destination Company game unique ID                                                      |
| destination_company.name              | `string`   | Destination Company name (Can be Null)                                                  |
| truck.unique_id                       | `string`   | Truck unique game ID                                                                    |
| truck.name                            | `string`   | Truck Name (Can be Null)                                                                |
| truck.brand.unique_id                 | `string`   | Truck Brand unique ID                                                                   |
| truck.brand.name                      | `string`   | Truck Brand name (Can be Null)                                                          |
| truck.odometer                        | `int`      | Truck odometer on job end in KMs                                                        |
| truck.initial_odometer                | `int`      | Truck odometer on job start in KMs                                                      |
| truck.wheel_count                     | `int`      | Number of wheels on Truck                                                               |
| truck.license_plate                   | `string`   | Truck License Plate                                                                     |
| truck.license_plate_country.unique_id | `string`   | Truck License Plate Country ID                                                          |
| truck.license_plate_country.name      | `string`   | Truck License Plate Country Name (Can be Null)                                          |
| truck.current_damage.cabin            | `float`    | Truck Current Damage - Cabin                                                            |
| truck.current_damage.chassis          | `float`    | Truck Current Damage - Chassis                                                          |
| truck.current_damage.engine           | `float`    | Truck Current Damage - Engine                                                           |
| truck.current_damage.transmission     | `float`    | Truck Current Damage - Transmission                                                     |
| truck.current_damage.wheels           | `float`    | Truck Current Damage - Wheels                                                           |
| truck.total_damage.cabin              | `float`    | Truck Total Damage - Cabin                                                              |
| truck.total_damage.chassis            | `float`    | Truck Total Damage - Chassis                                                            |
| truck.total_damage.engine             | `float`    | Truck Total Damage - Engine                                                             |
| truck.total_damage.transmission       | `float`    | Truck Total Damage - Transmission                                                       |
| truck.total_damage.wheels             | `float`    | Truck Total Damage - Wheels                                                             |
| truck.top_speed                       | `int`      | Truck top speed over Job                                                                |
| truck.average_speed                   | `int`      | Truck average speed over Job                                                            |
| trailers                              | `array`    | List of trailers on truck                                                               |
| events                                | `array`    | List of events which happened during Job                                                |

### Trailers payload

```json
{
  "name": null,
  "body_type": "_chciernsoor",
  "chain_type": "single",
  "wheel_count": 6,
  "brand": null,
  "license_plate": "I-2604",
  "license_plate_country": {
    "unique_id": "latvia",
    "name": "Latvia"
  },
  "current_damage": {
    "cargo": 0,
    "chassis": 0,
    "wheels": 0
  },
  "total_damage": {
    "cargo": 0,
    "chassis": 0,
    "wheels": 0
  }
}
```

**Properties**

| Property                        | Type     | Description                                               |
|---------------------------------|----------|-----------------------------------------------------------|
| name                            | `string` | Name of the trailer                                       |
| body_type                       | `string` | Body type of trailer                                      |
| chain_type                      | `string` | Chain type of trailer e.g. `single`, `double`             |
| wheel_count                     | `int`    | Wheel count of trailer                                    |
| brand                           | `dict`   | Trailer Brand, returns `unique_id` & `name` (Can be NULL) |
| license_plate                   | `string` | Trailer License Plate                                     |
| license_plate_country.unique_id | `string` | Trailer License Plate Country Unique ID                   |
| license_plate_country.name      | `string` | Traier License Plate Country name (Can be NULL)           |
| current_damage.cargo            | `float`  | Trailer current damage - Cargo                            |
| current_damage.chassis          | `float`  | Trailer current damage - Chassis                          |
| current_damage.wheels           | `float`  | Trailer current damage - Wheels                           |
| total_damage.cargo              | `float`  | Trailer total damage - Cargo                              |
| total_damage.chassis            | `float`  | Trailer total damage - Chassis                            |
| total_damage.wheels             | `float`  | Trailer total damage - Wheels                             |

### Mods Payload

```json
{
  "name": "Example Mod",
  "package": "example_mod"
}
```

**Properties**

| Property | Type     | Description     |
|----------| -------- |-----------------|
| name     | `string` | Name of the mod |
| package  | `string` | ID of the mod   |
