# API Examples

### Request & Response Payloads

You need to request the PreETA information for each job.

#### Example request payload:

```json
{
    parcelNumber (*): "00JI2G26",
    estimatedDeliveryDate: "2025-03-31",
    address:{
        street (*): "Oranienstr. 183",
        countryCode (*): "DE",
        houseNumber: "50",
        postalCode: "10999",
        locality: "Berlin",
        province: null
    }

}
```

#### Example response payload (sync & async):

```json
[{
    lowerBound: "10:15:00", (LocalTime)
    upperBound: "13:15:00", (LocalTime)
    date: "2025-03-31" (LocalDate)
}]
```

#### Prediction granularity

- Delivery windows are provided in 15-minute increments (aligned to :00, :15, :30, :45).
- Example: 14:15:00 – 16:15:00 means the predicted delivery is most likely within this window, rounded to the nearest quarter-hour.


### API Authentication & Security

All API requests require authentication via OAuth 2.0. You can request them from your Bettermile representative. Additional details are available in the developer portal.

- Use HTTPS with valid certificates for all connections, including tenant-provided webhook endpoints.
- Never expose credentials in frontend code.