Мы создали бесплатный и одновременно мощный инструмент, чтобы снять весь ручной труд с плеч наших клиентов.
YouSend API — это абсолютно автоматическое оформление отправлений. Каждый раз, когда клиент размещает заказ на вашем сайте или на другой онлайн-площадке, посылка автоматически создаётся на yousend.lv. Иными словами, заказчики получат груз, а нашему клиенту даже не придётся его оформлять, ведь его сайт сам передаст информацию для оформления посылки на YouSend.lv.
API-документация, приведённая ниже, — это и есть тот самый инструмент, позволяющий интегрироваться с YouSend, синхронизируя данные с сервисом выгодного оформления посылок.
Узнайте, как полностью автоматизировать логистику с нашим сервисом фулфилмент.
Пожалуйста, пусть вас не смущает приведённый ниже код. Его по-настоящему легко понять любому, кто связан с программированием. Это и есть готовый инструмент интеграции. Просто скопируйте ссылку и отправьте её разработчикам, они легко установят API-соединение с YouSend.lv.
Однако если вам потребуется какая-либо консультация, пожалуйста, свяжитесь с нами, будем рады помочь!
api.Important notes.
The base URL of the api is located at https://yousend.lv/api/[_env]/v1
You authenticate against the API using "Bearer authentication":
every request to a protected endpoint must carry your API key
in the Authorization header.
*** HOW TO GET AN API KEY ***
1. Sign in to your YouSend account.
2. Open the "API" section in the top menu of your account.
3. Press "Create key", give it a name (e.g. "My shop").
4. Copy the key immediately - it is shown ONLY ONCE
and is never stored in plain text.
The key is valid for 365 days. You can see your active keys
(with "valid until" and "last used" dates) and revoke any of them
in the same "API" section at any moment.
*** HOW TO USE THE KEY ***
Send it with every request to protected endpoints:
$headers = [
Accept : application/json,
Authorization : Bearer YOUR_API_KEY
];
Example:
curl -H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
"https://yousend.lv/api/production/v1/services/shipments?date_form=2026-01-01&date_to=2026-12-31"
*** NOTES ***
- Password login for the API has been removed: YouSend accounts
sign in via magic link, so there is no password to log in with.
Access to the API is managed only with keys from your account.
- If a key leaks, revoke it in User settings -> "API" and create
a new one.
The base URL of the api is located at https://yousend.lv/api/[_env]/v1
Example for getting prices for delivery services.
*** REQUEST METHOD ***
GET
*** REQUEST URL ***
PRODUCTION URL:
https://yousend.lv/api/production/v1/services/calculate;
DEVELOPMENT URL:
https://yousend.lv/api/development/v1/services/calculate;
*** REQUEST HEADERS ***
$headers = [
Content-Type : application/json,
Accept : application/json
];
=============================== Austria 4690 2 packages ===============================
- 2 Kg [27 x 28 x 29]
- 3 Kg [50 x 50 x 50]
REQUEST URL:
https://yousend.lv/api/development/v1/services/calculate?zip_code=4690&weight%5B%5D=2
&length%5B%5D=27&width%5B%5D=28&height%5B%5D=29&weight%5B%5D=3&length%5B%5D=50
&width%5B%5D=50&height%5B%5D=50&country_code=at&package_type=1&send_adr=0
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "OK",
"data": [
{
"package_type": 1,
"service_code": "ups_standard",
"service_name": "UPS Standard",
"final_price_without_tax": "52.68",
"final_price_with_tax": "63.74",
"is_eu": 1,
"service_type": 2,
"zip_code": "4690",
"country_code": "at",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
},
{
"weight": "3",
"length": "50",
"height": "50",
"width": "50"
}
],
"delivery_days": "5-6"
},
{
"package_type": 1,
"service_code": "ups_express_saver",
"service_name": "UPS Express Saver",
"final_price_without_tax": "144.71",
"final_price_with_tax": "175.10",
"is_eu": 1,
"service_type": 1,
"zip_code": "4690",
"country_code": "at",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
},
{
"weight": "3",
"length": "50",
"height": "50",
"width": "50"
}
],
"delivery_days": "1-2"
}
]
}
=============================== Austria 4690 1 packages ===============================
- 2 Kg [27 x 28 x 29]
REQUEST URL:
https://yousend.lv/api/development/v1/services/calculate?zip_code=4690&weight%5B%5D=2
&length%5B%5D=27&width%5B%5D=28&height%5B%5D=29&country_code=at&package_type=1&send_adr=0
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "OK",
"data": [
{
"package_type": 1,
"service_code": "ups_standard",
"service_name": "UPS Standard",
"final_price_without_tax": "34.18",
"final_price_with_tax": "41.36",
"is_eu": 1,
"service_type": 2,
"zip_code": "4690",
"country_code": "at",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "5-6"
},
{
"package_type": 1,
"service_code": "ups_express_saver",
"service_name": "UPS Express Saver",
"final_price_without_tax": "50.27",
"final_price_with_tax": "60.83",
"is_eu": 1,
"service_type": 1,
"zip_code": "4690",
"country_code": "at",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "1-2"
},
{
"package_type": 1,
"service_code": "dpd_classic",
"service_name": "DPD Classic",
"final_price_without_tax": "23.36",
"final_price_with_tax": "28.27",
"is_eu": 1,
"service_type": 2,
"zip_code": "4690",
"country_code": "at",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "4-5"
}
]
}
=============================== Austria 4690 1 envelope ===============================
- 0.5 Kg [27 x 28 x 29]
REQUEST URL:
https://yousend.lv/api/development/v1/services/calculate?&zip_code=4690
&weight%5B%5D=0.5&country_code=at&package_type=2&send_adr=0
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "OK",
"data": [
{
"package_type": 2,
"service_code": "ups_express_saver",
"service_name": "UPS Express Saver",
"final_price_without_tax": "33.46",
"final_price_with_tax": "40.49",
"is_eu": 1,
"service_type": 1,
"zip_code": "4690",
"country_code": "at",
"dimensions": [
{
"weight": "0.5",
"length": 10,
"height": 10,
"width": 10
}
],
"delivery_days": "1-2"
},
{
"package_type": 2,
"service_code": "ups_express_envelope",
"service_name": "UPS Express Envelope",
"final_price_without_tax": "33.46",
"final_price_with_tax": "40.49",
"is_eu": 1,
"service_type": 1,
"zip_code": "4690",
"country_code": "at",
"dimensions": [
{
"weight": "0.5",
"length": 10,
"height": 10,
"width": 10
}
],
"delivery_days": "1-2"
}
]
}
=============================== Austria 4690d 2 packages ===============================
- 2 Kg [27 x 28 x 29]
- 3 Kg [50 x 50 x 50]
REQUEST URL:
https://yousend.lv/api/development/v1/services/calculate?zip_code=4690d&weight%5B%5D=2
&length%5B%5D=27&width%5B%5D=28&height%5B%5D=29&weight%5B%5D=3&length%5B%5D=50
&width%5B%5D=50&height%5B%5D=50&country_code=at&package_type=1&send_adr=0
STATUS CODE [422] - VALIDATION ERROR
{
"type": "error",
"message": "An exception has been raised as a result of client data",
"errors": {
"zip_code": [
"Available post code format(s):0000"
]
}
}
=============================== Austria 4690 2 packages ===============================
- 2 Kg [27 x 28 x 29]
- 3 Kg [50 x 50 x 50]
REQUEST URL:
https://yousend.lv/api/development/v1/services/calculate?zip_code=4690d&weight%5B%5D=2
&length%5B%5D=27&width%5B%5D=28&height%5B%5D=29&weight%5B%5D=3&length%5B%5D=50
&width%5B%5D=50&height%5B%5D=50&country_code=at&parcel_copy_id=&package_type=3&send_adr=0
STATUS CODE [422] - VALIDATION ERROR
{
"type": "error",
"message": "An exception has been raised as a result of client data",
"errors": {
"package_type": [
"The selected package type is invalid.",
"The package type may not be greater than 2."
]
}
}
=============================== Lithuania LT-17248 1 packages ===============================
- 2 Kg [27 x 28 x 29]
If you want to use DPD "Cash On Delivery" service.
Please specify the "Cash to be collected" price in the "parcel_price" field.
To get the current and final cost for the DPD Cash service.
REQUEST URL:
https://yousend.lv/api/development/v1/services/calculate?zip_code=LT-17248&weight%5B%5D=2
&length%5B%5D=27&width%5B%5D=28&height%5B%5D=29&country_code=LT&package_type=1&send_adr=0&parcel_price=129.99
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "OK",
"data": [
{
"package_type": 1,
"service_code": "ups_standard",
"service_name": "UPS Standard",
"final_price_without_tax": "30.28",
"final_price_with_tax": "36.64",
"is_eu": 1,
"service_type": 2,
"zip_code": "LT-17248",
"country_code": "LT",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "2-3"
},
{
"package_type": 1,
"service_code": "ups_express_saver",
"service_name": "UPS Express Saver",
"final_price_without_tax": "42.79",
"final_price_with_tax": "51.78",
"is_eu": 1,
"service_type": 1,
"zip_code": "LT-17248",
"country_code": "LT",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "1-2"
},
{
"package_type": 1,
"service_code": "dpd_classic",
"service_name": "DPD Classic",
"final_price_without_tax": "12.04",
"final_price_with_tax": "14.57",
"is_eu": 1,
"service_type": 2,
"zip_code": "LT-17248",
"country_code": "lt",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "1-2"
},
{
"package_type": 1,
"service_code": "ups_express",
"service_name": "UPS Express",
"final_price_without_tax": "49.55",
"final_price_with_tax": "59.96",
"is_eu": 1,
"service_type": 1,
"zip_code": "LT-17248",
"country_code": "LT",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "1-2"
},
{
"package_type": 1,
"service_code": "dpd_cod",
"service_name": "DPD Cash On Delivery",
"final_price_without_tax": "18.64",
"final_price_with_tax": "22.55",
"is_eu": 1,
"service_type": 2,
"zip_code": "LT-17248",
"country_code": "lt",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "29",
"width": "28"
}
],
"delivery_days": "1-2"
}
]
}
The base URL of the api is located at https://yousend.lv/api/[_env]/v1
An examples of how to create a new order.
*** REQUEST METHOD ***
POST
*** REQUEST METHOD ***
PRODUCTION URL:
https://yousend.lv/api/production/v1/services/order-store
DEVELOPMENT URL:
https://yousend.lv/api/development/v1/services/order-store
*** REQUEST HEADERS ***
$headers = [
Content-Type : application/json,
Accept : application/json
Authorization : Bearer 'TOKEN'
];
=============================== Austria 4690 2 packages ===============================
- 2 kg [27 x 28 x 29]
- 3 kg [50 x 50 x 50]
REQUEST DATA:
{
"send_adr":"1",
"parcel_price":"8.99",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2020-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"2","3"
],
"length":[
"27","50"
],
"height":[
"28","50"
],
"width":[
"29","50"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_company_name":"SIA GT",
"recipient_city":"AMPASS",
"recipient_state_or_province" : "",
"zip_code":"4690",
"country_code":"at",
"recipient_name":"Petter",
"recipient_phone":"29878473829",
"recipient_email":"petterparker@gmail.com",
"package_type":"1",
"service_code":"ups_express_saver"
}
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "Shipment has been successfully created",
"data": {
"shipment_id": 27837
}
}
=============================== Austria 4690 1 packages ===============================
- 2 kg [27 x 28 x 29]
REQUEST DATA:
{
"send_adr":"1",
"parcel_price":"8.99",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2020-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"2"
],
"length":[
"27"
],
"height":[
"28"
],
"width":[
"29"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_company_name":"SIA GT",
"recipient_city":"AMPASS",
"recipient_state_or_province":"",
"zip_code":"4690",
"country_code":"at",
"recipient_name":"Petter",
"recipient_phone":"29878473829",
"recipient_email":"petterparker@gmail.com",
"package_type":"1",
"service_code":"ups_express_saver"
}
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "Shipment has been successfully created",
"data": {
"shipment_id": 27838
}
}
=============================== Austria 4690 1 envelope ===============================
- 0.5 kg
REQUEST DATA:
{
"send_adr":"1",
"parcel_price":"8.99",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2020-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"0.5"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_company_name":"SIA GT",
"recipient_city":"AMPASS",
"recipient_state_or_province":"",
"zip_code":"4690",
"country_code":"at",
"recipient_name":"Petter",
"recipient_phone":"29878473829",
"recipient_email":"petterparker@gmail.com",
"package_type":"2",
"service_code":"ups_express_saver"
}
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "Shipment has been successfully created",
"data": {
"shipment_id": 27839
}
}
=============================== Austria 4690d 2 packages ===============================
- 2 kg [27 x 28 x 29]
- 3 kg [50 x 50 x 50]
REQUEST DATA:
{
"send_adr":"1",
"parcel_price":"8.99",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2020-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"2","3"
],
"length":[
"27","50"
],
"height":[
"28","50"
],
"width":[
"29","50"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_company_name":"SIA GT",
"recipient_city":"AMPASS",
"recipient_state_or_province":"",
"zip_code":"4690d",
"country_code":"at",
"recipient_name":"Petter",
"recipient_phone":"29878473829",
"recipient_email":"petterparker@gmail.com",
"package_type":"1",
"service_code":"ups_express_saver"
}
STATUS CODE [422] - VALIDATION ERROR
{
"type": "error",
"message": "An exception has been raised as a result of client data",
"errors": {
"zip_code": [
"Available post code format(s):0000"
]
}
}
=============================== Austria 4690 1 envelope ===============================
- 0.5 kg
REQUEST DATA:
{
"send_adr":"1",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2020-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"0.5"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_city":"AMPASS",
"recipient_state_or_province":"22222",
"zip_code":"4690",
"recipient_name":"Petter",
"package_type":"2",
"service_code":"ups_express_saver"
}
STATUS CODE [422] - VALIDATION ERROR
{
"type": "error",
"message": "An exception has been raised as a result of client data",
"errors": {
"recipient_phone": [
"A recipient Phone number is required, Please add it!"
],
"recipient_state_or_province": [
"The state or province may not be greater than 4 characters."
],
"country_code": [
"A recipient Country is required, Please add it!"
],
"parcel_price": [
"A parcel price is required, Please add it!"
]
}
}
=============================== Austria 4690 2 envelopes ===============================
- 2 kg
- 3 kg
REQUEST DATA:
{
"send_adr":"1",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2020-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"2.0", "3.0"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_city":"AMPASS",
"recipient_state_or_province":"TILON",
"zip_code":"4690",
"recipient_name":"Petter",
"package_type":"2",
"service_code":"ups_express_saver"
}
STATUS CODE [422] - VALIDATION ERROR
{
"type": "error",
"message": "An exception has been raised as a result of client data",
"errors": {
"recipient_phone": [
"A recipient Phone number is required, Please add it!"
],
"recipient_state_or_province": [
"The state or province may not be greater than 4 characters."
],
"country_code": [
"A recipient Country is required, Please add it!"
],
"parcel_price": [
"A parcel price is required, Please add it!"
]
}
}
=============================== Empty data ===============================
REQUEST DATA:
{
}
STATUS CODE [422] - VALIDATION ERROR
{
"type": "error",
"message": "An exception has been raised as a result of client data",
"errors": {
"send_adr": [
"The ADR field is required."
],
"recipient_name": [
"A recipient name is required, Please add it!"
],
"recipient_phone": [
"A recipient Phone number is required, Please add it!"
],
"recipient_address_1": [
"A recipient delivery address is required, Please add it!"
],
"recipient_city": [
"A recipient City is required, Please add it!"
],
"country_code": [
"A recipient Country is required, Please add it!"
],
"zip_code": [
"The zip code field is required."
],
"parcel_price": [
"A parcel price is required, Please add it!"
],
"service_code": [
"The service code field is required."
],
"reason_for_export": [
"The validation.attribute.reason_for_export field is required."
],
"parcel_currency": [
"Please select a currency type!"
],
"parcel_pickup_date": [
"A pickup date is required, Please add it!"
],
"parcel_description": [
"A parcel description is required, Please add it!"
],
"parcel_pickup_address": [
"A parcel pickup address is required, Please add it!"
]
}
}
=============================== Austria 4690d 2 packages ===============================
- 2 kg [27 x 28 x 29]
- 3 kg [50 x 50 x 50]
REQUEST DATA:
{
"send_adr":"1",
"parcel_price":"8.99",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2020-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"2","3"
],
"length":[
"27"
],
"height":[
"28"
],
"width":[
"29","50"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_company_name":"SIA GT",
"recipient_city":"AMPASS",
"recipient_state_or_province":"TILON",
"zip_code":"4690d",
"country_code":"at",
"recipient_name":"Petter",
"recipient_phone":"29878473829",
"recipient_email":"petterparker@gmail.com",
"package_type":"1",
"service_code":"ups_express_saver"
}
STATUS CODE [422] - VALIDATION ERROR
{
"type": "error",
"message": "An exception has been raised as a result of client data",
"errors": {
"recipient_state_or_province": [
"The state or province may not be greater than 4 characters."
]
}
}
=============================== Lithuania LT-17248 1 packages ===============================
- 2 Kg [27 x 28 x 29]
If you want to use DPD "Cash On Delivery" service.
Please specify the "Cash to be collected" price in the "parcel_price" field.
To get the current and final cost for the DPD Cash service.
REQUEST DATA:
{
"send_adr":"1",
"parcel_price":"129.99",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
"parcel_description":"Books",
"parcel_sender":"Petter Parker",
"parcel_pickup_address":"Marupes 56",
"parcel_pickup_date":"2019-01-31 17:26:24",
"reason_for_export":"sold",
"weight":[
"2"
],
"length":[
"27"
],
"height":[
"28"
],
"width":[
"29"
],
"recipient_house_number":"23",
"recipient_address_1":"test 5-6",
"recipient_company_name":"SIA GT",
"recipient_city":"AMPASS",
"recipient_state_or_province":"",
"zip_code":"LT-17248",
"country_code":"lt",
"recipient_name":"Petter",
"recipient_phone":"29878473829",
"recipient_email":"petterparker@gmail.com",
"package_type":"1",
"service_code":"dpd_cod"
}
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "Shipment has been successfully created",
"data": {
"shipment_id": 27839
}
}
When the parcel is confirmed in the YouSend system, the parcel tracking number is assigned to your registered parcel. In order for you to receive a tracking number at the same moment, you need to specify an additional field "callback_success_url" - full address URL, to which a client will get information about shipment, in "Запрос нового отправления".
Your script must return the message "OK". Only then our system will register, that information about the shipment has been successfully received.
The base URL of the api is located at https://yousend.lv/api/[_env]/v1
An examples of how to create a new order with a callback url.
*** REQUEST METHOD ***
POST
*** REQUEST METHOD ***
PRODUCTION URL:
https://yousend.lv/api/production/v1/services/order-store
DEVELOPMENT URL:
https://yousend.lv/api/development/v1/services/order-store
*** REQUEST HEADERS ***
$headers = [
Content-Type : application/json,
Accept : application/json
Authorization : Bearer 'TOKEN'
];
=============================== Austria 4690 2 packages ===============================
- 2 kg [27 x 28 x 29]
- 3 kg [50 x 50 x 50]
REQUEST DATA:
{
"send_adr":"1",
"parcel_price":"8.99",
"parcel_currency":"1", // 0: EUR, 1: USD, 2: PLN
...
...
...
"callback_success_url": "https://my-site.com/shipment" // Full address URL
...
...
...
"package_type":"1",
"service_code":"ups_express_saver"
}
Below is an example of what shipping data will be sent from the YouSend API to your callback URL, which was specified in the field "callback_success_url" in request "Запрос нового отправления".
An example of a request with the data that will be sent from the YouSend API.
*** REQUEST METHOD ***
GET
*** REQUEST HEADERS ***
$headers = [
Content-Type : application/json,
Accept : application/json
];
=============================== Example №1 ===============================
REQUEST URL: Example with 3 parcel tracking numbers
<<_CALLBACK_URL>>?shipment_id=27854&tracking_numbers=1Z883V1R6899886732|1Z883V1R6899920346|1Z883V1R6897974757
=============================== Example №2 ===============================
REQUEST URL: Example with 1 parcel tracking numbers
<<_CALLBACK_URL>>?shipment_id=27854&tracking_numbers=1Z883V1R6899886732
If the callback request was successfully processed, you need to return a JSON Response with the message "OK", to inform us about the request that has been successfully received. If there is no answer "OK", the message will be sent 3 times, every request at the beginning of the hour. Below is an example of what JSON data your script should return upon successful completion.
An example of a response to a YouSend API request,
if the request was successfully processed in your system.
*** REQUEST HEADERS ***
$headers = [
Content-Type : application/json,
Accept : application/json
];
=============================== Example №1 ===============================
REQUEST DATA:
{
"message":"OK" // case insensitive string
}
The base URL of the api is located at https://yousend.lv/api/[_env]/v1
An example of how to get a list of personal orders.
*** REQUEST METHOD ***
GET
*** REQUEST URL ***
PRODUCTION URL:
https://yousend.lv/api/production/v1/services/shipments;
DEVELOPMENT URL:
https://yousend.lv/api/development/v1/services/shipments;
*** REQUEST HEADERS ***
$headers = [
Content-Type : application/json,
Accept : application/json
Authorization : Bearer 'TOKEN'
];
====================================== Example №1 ======================================
Request URL:
https://yousend.lv/api/development/v1/services/shipments?date_form=2022-01-01&date_to=2022-01-18
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "OK",
"shipment_ids": [
274040,
274041,
....
....
....
274060
]
}
====================================== Example №2 ======================================
REQUEST URL:
https://yousend.lv/api/development/v1/services/shipments??date_form=2022-01-01&date_to=2022-01-01
STATUS CODE [200] - REQUEST SUCCESS
{
"type": "success",
"message": "OK",
"shipment_ids": []
}
====================================== Example №3 ======================================
REQUEST URL:
https://yousend.lv/api/development/v1/services/shipments??date_form=2022-01-01&date_to=22022-01-18
STATUS CODE [422] - VALIDATION ERROR
{
"message": "The given data was invalid.",
"errors": {
"date_to": [
"The date to is not a valid date.",
"The date to does not match the format Y-m-d.",
"The date to may not be greater than 10 characters."
]
}
}
====================================== Example №4 ======================================
REQUEST URL:
https://yousend.lv/api/development/v1/services/shipments??date_form=2022-01-01&date_to=2022-01-18
STATUS CODE [500] - SERVER ERROR
{
"message": "A server error has occurred. Please inform the administrator."
}
The base URL of the api is located at https://yousend.lv/api/[_env]/v1
An example of how to get order details.
*** REQUEST METHOD ***
GET
*** REQUEST URL ***
PRODUCTION URL:
https://yousend.lv/api/production/v1/services/shipment/{id};
DEVELOPMENT URL:
https://yousend.lv/api/development/v1/services/shipment/{id};
*** REQUEST HEADERS ***
$headers = [
Content-Type : application/json,
Accept : application/json
Authorization : Bearer 'TOKEN'
];
====================================== Example №1 ======================================
REQUEST URL:
https://yousend.lv/api/development/v1/services/shipment/27850
STATUS CODE [200] - REQUEST SUCCESS
{
"shipment": {
"id": 27850,
"tracking_numbers": [],
"reference_number": null,
"service": {
"name": "DPD Cash On Delivery",
"code": "dpd_cod"
},
"parcel": {
"sender": "Petter Parker",
"price": "29.99",
"currency": 1,
"description": "Books",
"pickup_address": "Test 56",
"pickup_date": "2019-01-31 17:26:24",
"dimensions": [
{
"weight": "2",
"length": "27",
"height": "28",
"width": "29"
}
]
},
"recipient": {
"country": {
"name": "Lithuania",
"code": "LT"
},
"city": "TEST",
"zip_code": "LT-17248",
"state_or_province": "",
"address_1": "test 5-6",
"address_2": "",
"address_3": "",
"company_name": "SIA GT",
"name": "Petter",
"email": "petterparker@gmail.com",
"phone": "20202020"
},
"service_price": {
"without_tax": "430.41",
"with_tax": "520.80"
}
}
}
====================================== Example №2 ======================================
REQUEST URL:
https://yousend.lv/api/development/v1/services/shipment/278502
STATUS CODE [404] - RESOURCE NOT FOUND
{
"type": "error",
"message": "Resource not found"
}
====================================== Example №3 ======================================
REQUEST URL:
https://yousend.lv/api/production/v1/services/shipment/27830
STATUS CODE [422] - VALIDATION ERROR
{
"message": "Shipment not found or you don't have permission to view the order"
}
====================================== Example №4 ======================================
REQUEST URL:
https://yousend.lv/api/production/v1/services/shipment/27830
STATUS CODE [500] - SERVER ERROR
{
"message": "A server error has occurred. Please inform the administrator."
}
Введите email — пришлём безопасную ссылку для входа.
Продолжая, вы принимаете правила пользования и политику конфиденциальности.