Rates
Carrier offers for the route and parcel. The price price_cents is what the customer will pay. To purchase a label, provide the rate_id of the selected rate.
POST /rates
- Key Permission:
rates:read - Key: test or live
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
from.country |
string | yes | Country, two-letter ISO 3166-1 code (US, DE). |
from.postal_code |
string | yes | Postal code. |
from.city |
string | no | City. |
from.line1 |
string | no | Address: street and house number. |
from.line2 |
string | no | Apartment, office, floor. |
from.state |
string | no | State or region, e.g., NY. |
to.country |
string | yes | Country, two-letter ISO 3166-1 code (US, DE). |
to.postal_code |
string | yes | Postal code. |
to.city |
string | no | City. |
to.line1 |
string | no | Address: street and house number. |
to.line2 |
string | no | Apartment, office, floor. |
to.state |
string | no | State or region, e.g., NY. |
parcel.weight_g |
integer | yes | Weight in grams, integer, no more than 70000. |
parcel.length_mm |
integer | yes | Length in millimeters, integer, no more than 2000. |
parcel.width_mm |
integer | yes | Width in millimeters, integer, no more than 2000. |
parcel.height_mm |
integer | yes | Height in millimeters, integer, no more than 2000. |
declared_value_cents |
integer | no | Declared value in US cents. In the purchase method, defaults to the sum of the items. |
Important to know
- Rates are sorted by price, the first is the cheapest. If some carriers did not respond,
meta.partialwill betrue. rate_idis valid for 15 minutes and tied to the price, service, and parcel. It cannot be forged or substituted from another parcel.
Request example
curl -X POST https://api.shippickup.com/v1/rates \
-H "Authorization: Bearer $SHIPPICKUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": {
"country": "US",
"postal_code": "10001",
"city": "New York"
},
"to": {
"country": "DE",
"postal_code": "10117",
"city": "Berlin"
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80
},
"declared_value_cents": 5000
}'<?php
$body = [
'from' => [
'country' => 'US',
'postal_code' => '10001',
'city' => 'New York',
],
'to' => [
'country' => 'DE',
'postal_code' => '10117',
'city' => 'Berlin',
],
'parcel' => [
'weight_g' => 800,
'length_mm' => 250,
'width_mm' => 180,
'height_mm' => 80,
],
'declared_value_cents' => 5000,
];
$ch = curl_init('https://api.shippickup.com/v1/rates');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SHIPPICKUP_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($body),
]);
$response = json_decode((string) curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
print_r([$status, $response]);
import os
import requests
body = {
"from": {
"country": "US",
"postal_code": "10001",
"city": "New York",
},
"to": {
"country": "DE",
"postal_code": "10117",
"city": "Berlin",
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80,
},
"declared_value_cents": 5000,
}
r = requests.post(
"https://api.shippickup.com/v1/rates",
headers={
"Authorization": "Bearer " + os.environ["SHIPPICKUP_API_KEY"],
},
json=body,
timeout=30,
)
print(r.status_code, r.json())
const body = {
"from": {
"country": "US",
"postal_code": "10001",
"city": "New York"
},
"to": {
"country": "DE",
"postal_code": "10117",
"city": "Berlin"
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80
},
"declared_value_cents": 5000
};
const res = await fetch("https://api.shippickup.com/v1/rates", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SHIPPICKUP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(res.status, await res.json());
Response example 200
JSON
{
"data": [
{
"rate_id": "<rate_id>",
"carrier": "UPS",
"service": "Express Saver",
"price_cents": 4120,
"price": "41.20",
"currency": "USD",
"eta_days_min": 3,
"eta_days_max": 5,
"pickup_supported": true,
"chargeable_weight_g": 800
}
],
"meta": {
"count": 1,
"partial": false
}
}Possible errors
| HTTP | Code | Description |
|---|---|---|
| 422 | validation_failed | Error in request fields. error.details specifies the reason for each field. |
| 403 | insufficient_scope | Key lacks the required permission, specified in error.details.required_scope. |
| 429 | rate_limited | Key request limit exceeded. Retry after the time specified in the Retry-After header. |