The Get Shipping Rates endpoint returns real-time shipping rates from all your configured carriers for a given destination and package. Use it to show live rates at checkout or compare carrier pricing in your application.
Base URL
https://app.myshipi.com
Authentication
Every API request requires two credentials sent in the request body:
| Parameter | Type | Description |
|---|---|---|
shop_id | string | Your store’s integration key. Found in Settings > General. |
sitekey | string | Your website URL, base64-encoded. Example: base64_encode("https://mystore.com") |
Generating your sitekey
// PHP
$sitekey = base64_encode("https://mystore.com");
// JavaScript
const sitekey = btoa("https://mystore.com");
// Python
import base64
sitekey = base64.b64encode(b"https://mystore.com").decode()
Keep your credentials safe. Never expose your
shop_idin client-side code. Always make API calls from your server.
Endpoint
POST /rates_api/shipi_rates.php
Returns real-time shipping rates from all configured carriers for a given destination and package.
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
shop_id | string | Yes | Your integration key |
sitekey | string | Yes | Base64-encoded website URL |
receiver_address | object | Yes | Destination address |
products | array | Yes | Array of product objects with weight/dimensions |
currency | string | No | Currency code for rates (e.g. “USD”, “EUR”). Defaults to your store currency. |
Receiver Address Object
You only need the destination fields for rate calculation:
| Field | Type | Required | Description |
|---|---|---|---|
r_city | string | Yes | Destination city |
r_state | string | No | State/Province code (required for US, CA, AU) |
r_zip | string | Yes | Destination postal/ZIP code |
r_country | string | Yes | ISO 2-letter country code (e.g. “US”, “DE”, “GB”) |
Product Object
| Field | Type | Description |
|---|---|---|
name | string | Product name |
quantity | integer | Quantity of this product |
weight | number | Weight per unit (in kg or lbs based on your settings) |
price | number | Product price (used for customs/insurance calculations) |
Example Request
{
"shop_id": "your_integration_key",
"sitekey": "aHR0cHM6Ly9teXN0b3JlLmNvbQ==",
"receiver_address": {
"r_city": "Berlin",
"r_state": "",
"r_zip": "10115",
"r_country": "DE"
},
"products": [
{
"name": "T-Shirt",
"quantity": 2,
"weight": 0.3,
"price": 29.99
}
],
"currency": "USD"
}
Success Response
The response returns an array of available rates sorted by price:
{
"success": true,
"rates": [
{
"carrier": "dhl",
"service_name": "DHL Express Worldwide",
"service_code": "P",
"rate": 24.50,
"currency": "USD",
"estimated_days": "2-4"
},
{
"carrier": "fedex",
"service_name": "FedEx International Economy",
"service_code": "INTERNATIONAL_ECONOMY",
"rate": 31.20,
"currency": "USD",
"estimated_days": "4-6"
}
]
}
Rate Object Fields
| Field | Type | Description |
|---|---|---|
carrier | string | Carrier code (e.g. “dhl”, “fedex”, “ups”) |
service_name | string | Human-readable service name |
service_code | string | Carrier-specific service code (use this when creating shipments) |
rate | number | Shipping cost |
currency | string | Currency of the rate |
estimated_days | string | Estimated delivery time range |
Error Response
{
"success": false,
"msg": "Invalid credentials or store not found."
}
Important Notes
- Only carriers you have configured in your Shipi account will return rates.
- Rates are cached for 90 seconds to improve performance. Identical requests within this window return cached results.
- All configured carriers are queried in parallel for the fastest possible response.
- If a carrier returns an error (e.g., doesn’t ship to the destination), it will be omitted from the results — you’ll only see successful rates.
- The
service_codefrom the rate response can be passed directly to the Create Shipment endpoint.
Code Examples
cURL
curl -X POST https://app.myshipi.com/rates_api/shipi_rates.php \
-H "Content-Type: application/json" \
-d '{
"shop_id": "your_integration_key",
"sitekey": "aHR0cHM6Ly9teXN0b3JlLmNvbQ==",
"receiver_address": {
"r_city": "Berlin",
"r_state": "",
"r_zip": "10115",
"r_country": "DE"
},
"products": [
{
"name": "T-Shirt",
"quantity": 2,
"weight": 0.3,
"price": 29.99
}
],
"currency": "USD"
}'
PHP
$data = [
'shop_id' => 'your_integration_key',
'sitekey' => base64_encode('https://mystore.com'),
'receiver_address' => [
'r_city' => 'Berlin',
'r_state' => '',
'r_zip' => '10115',
'r_country' => 'DE'
],
'products' => [
[
'name' => 'T-Shirt',
'quantity' => 2,
'weight' => 0.3,
'price' => 29.99
]
],
'currency' => 'USD'
];
$ch = curl_init('https://app.myshipi.com/rates_api/shipi_rates.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($response['success']) {
foreach ($response['rates'] as $rate) {
echo $rate['carrier'] . ' - ' . $rate['service_name'] . ': $' . $rate['rate'] . "\n";
}
} else {
echo "Error: " . $response['msg'];
}
Node.js
const response = await fetch('https://app.myshipi.com/rates_api/shipi_rates.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
shop_id: 'your_integration_key',
sitekey: Buffer.from('https://mystore.com').toString('base64'),
receiver_address: {
r_city: 'Berlin',
r_state: '',
r_zip: '10115',
r_country: 'DE'
},
products: [
{ name: 'T-Shirt', quantity: 2, weight: 0.3, price: 29.99 }
],
currency: 'USD'
})
});
const result = await response.json();
if (result.success) {
result.rates.forEach(rate => {
console.log(`${rate.carrier} - ${rate.service_name}: $${rate.rate} (${rate.estimated_days} days)`);
});
} else {
console.error(`Error: ${result.msg}`);
}
Python
import requests
import base64
response = requests.post('https://app.myshipi.com/rates_api/shipi_rates.php', json={
'shop_id': 'your_integration_key',
'sitekey': base64.b64encode(b'https://mystore.com').decode(),
'receiver_address': {
'r_city': 'Berlin',
'r_state': '',
'r_zip': '10115',
'r_country': 'DE'
},
'products': [
{'name': 'T-Shirt', 'quantity': 2, 'weight': 0.3, 'price': 29.99}
],
'currency': 'USD'
})
result = response.json()
if result['success']:
for rate in result['rates']:
print(f"{rate['carrier']} - {rate['service_name']}: ${rate['rate']} ({rate['estimated_days']} days)")
else:
print(f"Error: {result['msg']}")
Common Use Case: Checkout Rate Display
A typical integration flow for showing rates at checkout:
- Customer enters their shipping address at checkout.
- Your server calls the Get Shipping Rates endpoint with the destination and cart items.
- Display the returned rates as shipping options for the customer to choose from.
- When the customer selects a rate and places the order, use the
carrierandservice_codefrom their chosen rate to call the Create Shipment endpoint withexec_type: "auto".
Need help? Contact us at support@myshipi.com