# Upgrading API from v3 to v4

## Transport

### Status

Add the `sent_to_trucker` status category. When a transport is assigned to a trucker but not sent, the status is `assigned`.

### Invoicing address

`delivery.invoicing_address` is moved to `transport.invoicing_address`.

Before (v3)

```json
{
    "deliveries": [{
         "invoicing_address": {...}
    }]
}
```

After (v4)

```json
{
    "invoicing_address": {...},
    "deliveries": [{...}]
}
```

## Sites

### Asked time slots

The following fields are now removed:

```
arrival_date 
arrival_time_min 
arrival_time_max 
date_exact
```

They are replaced by the `slots` field, which represents the time slots asked by the shipper.

Two new fields are added: `real_start` and `real_end`, which are the actual times at which the trucker arrived on site and left the site.

Before (v3)

```json
{
    "uid": "aaaa-aaaa-aaaa-aaaa",
    "arrival_date": "2021-03-02",
    "arrival_time_min": "08:00",
    "arrival_time_max": "09:00",
    "date_exact": true
}
```

After (v4)

```json
{
    "uid": "aaaa-aaaa-aaaa-aaaa",
    "slots": [
        {
            "start": "2021-03-02T00:08:00Z", 
            "end": "2021-03-02T00:09:00Z"
        }
    ],
    "real_start": "2021-03-02T00:08:04Z", 
    "real_end": "2021-03-02T00:08:26Z", 
}
```

## Transport statuses

The field `holder_exchanges` is removed in v4. It is replaced by the dedicated `/api/v4/supports-exchanges/` and `/api/v4/support-types/` APIs.

## Transport messages (uploaded documents)

The field `delivery` is removed in v4.

## Delivery loads

Update type of `volume`, `weight`, `tare_weight` and `linear_meters` that are now float instead of string.

Before (v3)

```json
{
    "volume": "2.3",
    "weight": "230",
    "tare_weight": "1400",
    "linear_meters": "3.5"
}
```

After (v4)

```json
{
    "volume": 2.3,
    "weight": 230,
    "tare_weight": 1400,
    "linear_meters": 3.5
}
```

## Companies

### Country

The `country` field is now mandatory on companies.

## Truckers

The param `chartered` in the truckers filter (URL parameter) is renamed to `rental`.

```
GET https://api.dashdoc.eu/api/v4/truckers/?rental=true
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.dashdoc.com/docs/upgrades/upgrading-api-from-v3-to-v4.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
