Get Shipping Rates
Calculate shipping rates for packages
Get Shipping Rates
This endpoint allows users to retrieve shipping rates based on specified parameters, including the dimensions of the package, product type, sender and receiver details, and delivery type.
API Tester - Get Shipping Rates
Calculate shipping rates based on package details and addresses
Environment:
POST
https://dev-api.woowbd.com/api/v1/developer/get-shipping-rates
Get your token from: http://dev-app.woowbd.com/dashboard/developer
Request
- Method: POST
- Endpoint:
{{base_url}}/get-shipping-rates
Request Body
The request body should be in JSON format and include the following parameters:
box_dimension (Array of Objects)
An array containing box dimensions and items.
| Parameter | Type | Required | Description |
|---|---|---|---|
length | Number | Yes | The length of the box |
width | Number | Yes | The width of the box |
height | Number | Yes | The height of the box |
weight | Number | Yes | The weight of the box |
items | Array of Objects | Yes | An array of items contained within the box |
items (Array of Objects)
Each item object contains:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | Yes | The name of the item |
quantity | String | Yes | The quantity of the item |
unit_price | String | Yes | The price per unit of the item |
Other Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
product_type | String | Yes | The type of product being shipped (e.g., "1" for commercial) |
weight | Number | Yes | The total weight of the shipment |
weight_unit | String | Yes | The unit of weight (e.g., "LBS" for pounds) |
sender | Object | Yes | Information about the sender |
receiver | Object | Yes | Information about the receiver |
delivery_type | String | Yes | The type of delivery (e.g., "commercial") |
sender/receiver Object
| Parameter | Type | Required | Description |
|---|---|---|---|
address | String | Yes | The complete address of the sender/receiver |
state | String | Yes | The sender/receiver's state |
state_short_code | String | Yes | The short code for the sender/receiver's state |
city | String | Yes | The sender/receiver's city |
zip_code | String | Yes | The sender/receiver's zip code |
country_code | String | Yes | The sender/receiver's country code (e.g., "US", "BD") |
Example Request
curl -X POST "https://api.woowbd.com/get-shipping-rates" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"box_dimension": [
{
"length": 10,
"width": 8,
"height": 6,
"weight": 2.5,
"items": [
{
"name": "Sample Product",
"quantity": "2",
"unit_price": "29.99"
}
]
}
],
"product_type": "1",
"weight": 2.5,
"weight_unit": "LBS",
"sender": {
"address": "11370 Anderson St, Loma Linda, CA 92354, USA",
"state": "California",
"state_short_code": "CA",
"city": "Loma Linda",
"zip_code": "92354",
"country_code": "US"
},
"receiver": {
"address": "1143 Coleman Avenue, Queens, NY 11413, USA",
"state": "New York",
"state_short_code": "NY",
"city": "Queens",
"zip_code": "11413",
"country_code": "US"
},
"delivery_type": "commercial"
}'Response
The response will be in JSON format and includes the following structure:
- status (Boolean): Indicates whether the request was successful.
- message (String): A message providing additional information about the request.
- data (Array of Objects): Contains shipping rate information.
data Object Structure
| Parameter | Type | Description |
|---|---|---|
id | String | The unique identifier for the shipping rate |
request_id | String | The identifier for the request |
courier_name | String | The name of the courier service |
courier_type | String | The type of courier service |
delivery_time | Number | Estimated delivery time in hours |
delivery_time_text | String | Textual representation of delivery time |
description | String | Description of the shipping option |
home_delivery_fee | Number | Fee for home delivery |
import_tax | String | Applicable import tax information |
logo | String | URL to the courier's logo |
shipping_charge | Number | The charge for shipping |
- errors (Array): An array containing any errors that occurred during the request.
- response_code (String): The response code associated with the request.
Example Response
{
"status": true,
"message": "Shipping rates calculated successfully",
"data": [
{
"id": "rate_123456789",
"request_id": "req_987654321",
"courier_name": "FedEx",
"courier_type": "Express",
"delivery_time": 24,
"delivery_time_text": "1-2 business days",
"description": "FedEx Express shipping",
"home_delivery_fee": 5.00,
"import_tax": "Included",
"logo": "https://api.woowbd.com/logos/fedex.png",
"shipping_charge": 25.99
},
{
"id": "rate_987654321",
"request_id": "req_123456789",
"courier_name": "UPS",
"courier_type": "Ground",
"delivery_time": 72,
"delivery_time_text": "3-5 business days",
"description": "UPS Ground shipping",
"home_delivery_fee": 0.00,
"import_tax": "Not applicable",
"logo": "https://api.woowbd.com/logos/ups.png",
"shipping_charge": 15.50
}
],
"errors": [],
"response_code": "200"
}Notes
This endpoint is essential for businesses looking to calculate shipping costs effectively based on various parameters and conditions.
Code Examples
JavaScript
const response = await fetch('https://api.woowbd.com/get-shipping-rates', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
box_dimension: [
{
length: 10,
width: 8,
height: 6,
weight: 2.5,
items: [
{
name: "Sample Product",
quantity: "2",
unit_price: "29.99"
}
]
}
],
product_type: "1",
weight: 2.5,
weight_unit: "LBS",
sender: {
address: "11370 Anderson St, Loma Linda, CA 92354, USA",
state: "California",
state_short_code: "CA",
city: "Loma Linda",
zip_code: "92354",
country_code: "US"
},
receiver: {
address: "1143 Coleman Avenue, Queens, NY 11413, USA",
state: "New York",
state_short_code: "NY",
city: "Queens",
zip_code: "11413",
country_code: "US"
},
delivery_type: "commercial"
})
});
const data = await response.json();
console.log(data.data); // Array of shipping ratesPython
import requests
data = {
"box_dimension": [
{
"length": 10,
"width": 8,
"height": 6,
"weight": 2.5,
"items": [
{
"name": "Sample Product",
"quantity": "2",
"unit_price": "29.99"
}
]
}
],
"product_type": "1",
"weight": 2.5,
"weight_unit": "LBS",
"sender": {
"address": "11370 Anderson St, Loma Linda, CA 92354, USA",
"state": "California",
"state_short_code": "CA",
"city": "Loma Linda",
"zip_code": "92354",
"country_code": "US"
},
"receiver": {
"address": "1143 Coleman Avenue, Queens, NY 11413, USA",
"state": "New York",
"state_short_code": "NY",
"city": "Queens",
"zip_code": "11413",
"country_code": "US"
},
"delivery_type": "commercial"
}
response = requests.post(
'https://api.woowbd.com/get-shipping-rates',
headers={
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
},
json=data
)
result = response.json()
rates = result['data'] // Array of shipping ratesPHP
$data = [
'box_dimension' => [
[
'length' => 10,
'width' => 8,
'height' => 6,
'weight' => 2.5,
'items' => [
[
'name' => 'Sample Product',
'quantity' => '2',
'unit_price' => '29.99'
]
]
]
],
'product_type' => '1',
'weight' => 2.5,
'weight_unit' => 'LBS',
'sender' => [
'address' => '11370 Anderson St, Loma Linda, CA 92354, USA',
'state' => 'California',
'state_short_code' => 'CA',
'city' => 'Loma Linda',
'zip_code' => '92354',
'country_code' => 'US'
],
'receiver' => [
'address' => '1143 Coleman Avenue, Queens, NY 11413, USA',
'state' => 'New York',
'state_short_code' => 'NY',
'city' => 'Queens',
'zip_code' => '11413',
'country_code' => 'US'
],
'delivery_type' => 'commercial'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.woowbd.com/get-shipping-rates');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
$rates = $result['data']; // Array of shipping rates