Skip to main content

Calculate International Cost

Overview

The Calculate International Cost endpoint allows users to get shipping rates for international deliveries by specifying Indonesian origin, destination country, weight, courier, and price. This is useful for merchants or platforms that ship products overseas and need to provide accurate shipping costs to end customers before checkout.

This endpoint helps users compare multiple courier options based on price and estimated delivery time for international shipments.

Key Feature

  • 🌍 Supports International Shipping Calculation
  • 📦 Based on Weight, Origin City, and Destination Country
  • 🚚 Courier Selection Flexibility
  • 💰 Returns Pricing and Estimated Delivery Time

How it Works

  1. The client sends a POST request with required information
  2. RajaOngkir API processes the request using international rate database.
  3. A list of shipping options is returned.

Request Body

curl --location 'https://rajaongkir.komerce.id/api/v1/calculate/international-cost' \
--header 'key: inputapikey' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'courier={{ courier }}' \
--data-urlencode 'origin={{ origin_id }}' \
--data-urlencode 'destination={{ destination_id }}' \
--data-urlencode 'weight={{ weight }}' \
--data-urlencode 'price={{ sort_price }}'

Query Parameter

Headers

KeyTypeDescription
key*stringthis Value contain an secret APIKEY identic for Shipping Cost API

Body x-www-form-urlencode

KeyTypeDescription
origin*intthis Value containt an id during Search International Destinations
destination*intthis Value containt an id during Search International Destinations
weight*intthis Value containt an a package weight with grams estimated
courier*stringthis Value contain an Courier Name
pricebooleanthis Value Contain an boolean value, lowest or highest shipping cost
danger

For each header and parameter that has a * sign, it is a parameter that must be Required when making a request, otherwise there will be a system error that will warn the user regarding the request made.

Response

Response Structure

KeyValue (Description)
meta.messageResponse for searching address.
meta.codeAny response have different code.
meta.statusBoolean status for checking address.
data[].nameInformation about availability Courier Name
data[].codeInformation about availability Code of Courier
data[].serviceInformation about availability Service of Courier
data[].descriptionDescription about Courier
data[].currencyInformation about availability Currency of Courier
data[].costInformation about Courier Service Cost
data[].etdInformation about estimated time of courier delivery
data[].currency_updated_atInformation about Updated time for Currency Value
data[].currency_valueInformation about Currency Kurs Updated

Success Respons for Searching International Cost

{
"meta": {
"message": "Success Calculate International Shipping Cost",
"code": 200,
"status": "success"
},
"data": [
{
"name": "{{ courier.name }}",
"code": "{{ courier.code }}",
"service": "{{ courier.service }}",
"description": "{{ courier.desc }}",
"currency": "{{ availability.currency }}",
"cost": {{ shipping_cost }},
"etd": "{{ estimated_time_delivery }}",
"currency_updated_at": "{{ information_updated_currency }}",
"currency_value": {{ currency_kurs }}
}
]
}

Error Respons for Searching International Cost

{
"meta": {
"message": "{{ message }}",
"code": {{ code }},
"status": "{{ status }}"
},
"data": null
}

Status Code

CodeStatusDescriptionHow to Fix
200Success
400ErrorCalculate International Shipping Cost not foundThis error is unavoidable because the courier may not be able to provide the desired data.
400ErrorMissing ParamsMake sure the request parameters that are sent match the required parameters.
422ErrorInvalid CourierMake sure the courier code entered is correct according to the courier code guide available for checking.

Tips to Avoid Error

  • ✅ Ensure the origin id is correct — use the RajaOngkir Search Destination endpoint to get a valid id.
  • 🌐 Use a valid country code for the destination.
  • ⚖️ Weight is mandatory and should be greater than zero (in grams).
  • 🚫 Courier must support international shipments — not all couriers are available.
  • 🛡️ Authenticate with the correct API Key or the request will be rejected.