API интеграция Lastauka

Postman collection → OpenAPI spec →

Introduction

Клиентская документация по настройке интеграции через API.
Для вашего удобства информация по доступному функционалу разбита по разделам.

Авторизация

Для взаимодействия с сервисом требуется API токен.

Чтобы узнать свой API токен, необходимо зайти в раздел "Интеграция" в Личном кабинете

Далее при обращении к методам сервиса полученный токен передается в заголовке запроса в следующем виде:

Адреса

Нормализация адреса

POST
https://lastauka.by
/api/v1/address-clean
requires authentication

Разделяет и помещает сущности переданных адресов (город, улица) в соответствующие поля возвращаемого объекта.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/address-clean';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'address' => 'doloremque',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Заказы

Создание заказа

POST
https://lastauka.by
/api/v1/orders
requires authentication

Метод предназначен для создания в Lastauka заказа на доставку товаров до покупателей.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/orders';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'dimension' => [
                'weight' => 12.5,
                'length' => 10.0,
                'width' => 10.0,
                'height' => 10.0,
            ],
            'delivery_type_id' => 1,
            'tc_id' => 1,
            'declared_value' => 100.0,
            'address_to' => [
                'value' => 'Россия, Московская область, Москва, ул. Авангардная д. 9',
                'city' => 'Москва',
                'room' => '1',
                'floor' => '1',
                'house' => '9',
                'corpus' => null,
                'region' => 'Московская область',
                'street' => 'Авангардная',
                'district' => null,
                'entrance' => null,
                'country' => 'Россия',
            ],
            'recipient' => [
                'email' => 'exmail@example.com',
                'phone' => '+7 809 111 11 11',
                'last_name' => 'Иванов',
                'first_name' => 'Иван',
                'patronymic_name' => 'Иванович',
            ],
            'address_from' => [
                'city' => 'Брест',
                'room' => '1',
                'floor' => '1',
                'house' => '9',
                'corpus' => null,
                'region' => 'Брестская область',
                'street' => 'Буденного',
                'district' => null,
                'entrance' => null,
                'country' => 'Беларусь',
            ],
            'sender' => [
                'email' => 'exmail@example.com',
                'first_name' => 'Иван',
                'last_name' => 'Иванов',
                'patronymic_name' => 'Иванович',
                'phone' => '+375 29 111 11 11',
            ],
            'extraServices' => [
                'completeness_checking' => false,
                'sms_notice_recipient' => false,
                'fitting' => false,
            ],
            'order_num' => '12345',
            'comment' => 'Очень важная информация',
            'cod_value' => 100.0,
            'point_id' => 8,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Информация о заказе

GET
https://lastauka.by
/api/v1/orders/{track}
requires authentication

Метод предназначен для получения детальной информации по заданному заказу. Есть возможность получить информацию в том числе о заказах, которые были созданы через другие каналы (личный кабинет и др.).

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

track
string
required

Трек-номер посылки

Example:
la-1017

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/orders/la-1017';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    vary
                                                            : Origin
                                                         
{
    "message": "Unauthenticated."
}

Удаление заказа

DELETE
https://lastauka.by
/api/v1/orders/{track}
requires authentication

Метод предназначен для удаления заказа.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

track
string
required

Трек-номер посылки

Example:
la-1017
Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/orders/la-1017';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Заказы. Первая миля

Создание заявки на первую милю

POST
https://lastauka.by
/api/v1/first-mile
requires authentication

Метод предназначен для создания в Lastauka заявки на первую милю.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/first-mile';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'dimension' => [
                'weight' => 12.5,
                'height' => 10.0,
                'length' => 10.0,
                'width' => 10.0,
            ],
            'address_to' => [
                'value' => 'Россия, Смоленская область, Смоленск, ул. Авиаторов д. 9',
                'city' => 'Смоленск',
                'room' => '1',
                'floor' => '1',
                'house' => '9',
                'corpus' => null,
                'region' => 'Смоленская область',
                'street' => 'Авиаторов',
                'district' => null,
                'entrance' => null,
                'country' => 'Россия',
            ],
            'recipient' => [
                'email' => 'exmail@example.com',
                'phone' => '+7 809 111 11 11',
                'last_name' => 'Иванов',
                'first_name' => 'Иван',
                'patronymic_name' => 'Иванович',
                'legal_address' => 'Смоленск ул. Авиаторов д. 9',
                'organization_name' => 'ООО "Организация"',
            ],
            'address_from' => [
                'city' => 'Брест',
                'room' => '1',
                'floor' => '1',
                'house' => '9',
                'corpus' => null,
                'region' => 'Брестская область',
                'street' => 'Буденного',
                'district' => null,
                'entrance' => null,
                'country' => 'Беларусь',
            ],
            'sender' => [
                'first_name' => 'Иван',
                'last_name' => 'Иванов',
                'patronymic_name' => 'Иванович',
                'phone' => '+375 29 111 11 11',
                'email' => 'exmail@example.com',
            ],
            'legal_data' => [
                'legal_address' => 'Брест ул. Буденного д. 9',
                'organization_name' => 'ООО "Организация"',
                'mailing_address' => 'email@ya.ru',
                'unp' => '123456789',
                'payment_account' => '0000000000000000000000000000',
                'recipient_bank' => 'ОАО "Банк"',
                'bic' => '123456789',
                'director' => 'Иванов Иван Иванович',
            ],
            'comment' => 'Очень важная информация',
            'declared_value' => 100.0,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Информация о заявке на первую милю

GET
https://lastauka.by
/api/v1/first-mile/{track}
requires authentication

Метод предназначен для получения детальной информации о заявке на первую милю. Есть возможность получить информацию в том числе о заказах, которые были созданы через другие каналы (личный кабинет и др.).

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

track
string
required

Трек-номер посылки

Example:
la-1017

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/first-mile/la-1017';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    vary
                                                            : Origin
                                                         
{
    "message": "Unauthenticated."
}

Удаление заявки на первую милю

DELETE
https://lastauka.by
/api/v1/first-mile/{track}
requires authentication

Метод предназначен для удаления заявки на первую милю.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

track
string
required

Трек-номер посылки

Example:
la-1017
Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/first-mile/la-1017';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Населенные пункты, отделения

Список отделений

GET
https://lastauka.by
/api/v1/points
requires authentication

Позволяет получить информацию о всех отделениях. Список отделений может быть ограничен характеристиками, задаваемыми пользователем.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

city_id
integer

ID города.

Example:
3
tc_id
integer

ID транспортной компании.
1 - Почтра России
2 - Boxberry

Example:
1
page
integer

Текущая страница.

Example:
1
per_page
integer

Количество элементов на странице (Минимум 100, максимум 1000, по умолчанию 100).

Example:
100

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/points';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'city_id' => '3',
            'tc_id' => '1',
            'page' => '1',
            'per_page' => '100',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    vary
                                                            : Origin
                                                         
{
    "message": "Unauthenticated."
}

Список населенных пунктов

GET
https://lastauka.by
/api/v1/cities
requires authentication

Позволяет получить список населенных пунктов, в которых есть отделения транспортных компаний. Список населенных пунктов может быть ограничен характеристиками, задаваемыми пользователем.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

tc_id
integer

ID транспортной компании. Example: 1
1 - Почтра России
2 - Boxberry

Example:
1
page
integer

Текущая страница.

Example:
1
per_page
integer

Количество элементов на странице (Минимум 100, максимум 1000, по умолчанию 100).

Example:
100

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/cities';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'tc_id' => '1',
            'page' => '1',
            'per_page' => '100',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    vary
                                                            : Origin
                                                         
{
    "message": "Unauthenticated."
}

Расчет стоимости доставки

Список тарифов

POST
https://lastauka.by
/api/v1/tariff/list
requires authentication

Метод позволяет получить список тарифов(стоимость и срок доставки), транспортных компаний, для указанного адреса. Стоимость приблизительна и может отличаться от реальной стоимости доставки. Для получения более точной стоимости доставки необходимо использовать метод "Расчет стоимости доставки".

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Response Fields

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://lastauka.by/api/v1/tariff/list';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'dimension' => [
                'weight' => 12.5,
                'length' => 10.0,
                'width' => 10.0,
                'height' => 10.0,
            ],
            'address_to' => [
                'value' => 'Россия, Московская область, Москва, ул. Авангардная д. 9',
                'city' => 'Москва',
                'room' => '1',
                'floor' => '1',
                'house' => '9',
                'corpus' => null,
                'region' => 'Московская область',
                'street' => 'Авангардная',
                'district' => null,
                'entrance' => null,
                'country' => 'Россия',
                'id' => 1,
            ],
            'cod_value' => 100.0,
            'declared_value' => 100.0,
            'extra' => [
                'fitting' => true,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));