-> Directs

To define directs you need to create a supplierlocation_id for the pickup and a deliverylocation_id for the delivery location. A delivery starts from the depot and has a delivery address. A pickup has a pickup address and is delivered to the depot. If you want to pickup goods 'on tour' you define two addresses that are not the depot.
You also need a time window defined by pdt_from and pdt_to in the ISO datetime format. 'pdt' describes the 'planned delivery time', i.e. the time window in which the goods are expected to arrive at its destination. If you don't provide a time window, we default to the earliest time to leave the depot and the latest time to return to the depot.

import requests
from datetime import datetime, timedelta

auth_header = {"Authorization": 'JWT ' + token}
api_url = "https://<your company name>.prd.smartlane.io/api"

url = api_url + "/delivery"

data = {"supplierlocation_id": 2,
        "deliverylocation_id": 3,
        "pdt_to": (datetime.now() + timedelta(days=1)).isoformat(),
        "pdt_from": datetime.now().isoformat()}

response = requests.post(url, headers=auth_header, json=data)
print (response.text)

Posting this call will return this response:

{
    "adr_needed": false,
    "als_seconds": null,
    "ata": null,
    "atd": null,
    "creationtime": null,
    "custom_id": "id_1",
    "custom_tour": null,
    "ddt_from": null,
    "ddt_to": null,
    "deliverprio": null,
    "delivery_address": {
        "additional": null,
        "addresstype": null,
        "city": "München",
        "code": null,
        "contactcompany": "Kunde 1",
        "contactfirstname": null,
        "contactlastname": null,
        "country": "DE",
        "customernr": null,
        "default_pdt_from": null,
        "default_pdt_to": null,
        "distances": null,
        "district": "Milbertshofen",
        "email": null,
        "housenumber": "9",
        "id": 3,
        "location": {
            "coordinates": [
                11.54526,
                48.18747
            ],
            "type": "Point"
        },
        "phonenr": null,
        "postalcode": "80809",
        "search_vector": "'12':2 'kunde':1",
        "street": "am oberwiesenfeld"
    },
    "delivery_items": [],
    "deliverylocation_id": 3,
    "deliverytype_id": null,
    "distances": null,
    "effective_loads": null,
    "els_seconds": 120,
    "eta": null,
    "eta_from": null,
    "eta_to": null,
    "final": null,
    "fixed_els_seconds": 120,
    "height": null,
    "id": 12,
    "length": null,
    "liftgate_needed": false,
    "load": null,
    "load_2": null,
    "load_3": null,
    "load_class_ids": null,
    "notes": null,
    "order_in_tour": 0,
    "orderindex": 12,
    "overload_ref": null,
    "pdt_break_ends": null,
    "pdt_break_starts": null,
    "pdt_from": "2022-08-17T15:35:25.697930+00:00",
    "pdt_to": "2022-08-18T15:35:25.697930+00:00",
    "pickup_id": null,
    "pickup_ref_id": null,
    "possible_vehicles": null,
    "ppt_from": null,
    "ppt_to": null,
    "process_id": null,
    "product_code": null,
    "recipientname": null,
    "recipienttype": null,
    "return_time": null,
    "route_id": null,
    "same_stop_unit": null,
    "shipment_type": null,
    "status": 0,
    "supplier_address": {
        "additional": null,
        "addresstype": null,
        "city": "München",
        "code": null,
        "contactcompany": "Kunde 2",
        "contactfirstname": null,
        "contactlastname": null,
        "country": "DE",
        "customernr": null,
        "default_pdt_from": null,
        "default_pdt_to": null,
        "distances": null,
        "district": "Schwabing",
        "email": null,
        "housenumber": "8",
        "id": 2,
        "location": {
            "coordinates": [
                11.57451,
                48.17422
            ],
            "type": "Point"
        },
        "phonenr": null,
        "postalcode": "80804",
        "search_vector": "'6':2 'kunde':1",
        "street": "kraepelinstr."
    },
    "supplierlocation_id": 2,
    "tdt_from": null,
    "tdt_to": null,
    "territory": null,
    "tfp": null,
    "tfp_seconds": null,
    "trailer_needed": false,
    "unit": null,
    "update_notes": null,
    "variable_els_seconds_per_load": null,
    "vehicletype_name": null,
    "waiting_time": null,
    "waiting_time_seconds": 0,
    "width": null
}

As you can see, each address can also have a default time window for delivery. This would be a fallback, if you don't provide pdt_from and pdt_to with the shipment data. As mentioned above we default to the settings of the global settings: DEFAULT_DAY_START and DEFAULT_DAY_END if no pdt is specified.