Search International Destination
Overviewβ
The Search International Destination endpoint is used to retrieve destination data for international shipments via the RajaOngkir integration. This feature enables merchants and systems to dynamically search and select destination countries outside of Indonesia, which is a key requirement for international shipping calculations and logistics workflows.
This endpoint is highly useful for e-commerce checkout systems, B2B platforms, or any application that needs to calculate or prepare international deliveries.
Key Featureβ
-
π Supports Global Shipping
Search for international destinations in various countries worldwide. -
π Seamless Integration with Cost Calculation
Returneddestination_code
can be used directly with cost calculation endpoints. -
π¦ Ready for International Logistics
Helps users accurately fill shipping forms for overseas deliveries.
How it Worksβ
-
Make a POST request to the endpoint with a
value
:- Value can include country names (e.g.,
"japan"
).
- Value can include country names (e.g.,
-
The API returns a list of matched locations, including:
- Country name, and a unique Country
id
for each.
- Country name, and a unique Country
-
Use the
conutry_id
in subsequent calls to thecalculate/international-cost
endpoint or when creating international shipment requests.
Request Bodyβ
- cURL
- JavaScript
- PHP
- GoLang
- Node
curl --location --globoff 'https://rajaongkir.komerce.id/api/v1/destination/international-destination?search={{%20search_region%20}}&limit=99&offset=99' \
--header 'key: inputapikey'
const myHeaders = new Headers();
myHeaders.append("key", "inputapikey");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://rajaongkir.komerce.id/api/v1/destination/international-destination?search={{ search_region }}&limit=99&offset=99", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rajaongkir.komerce.id/api/v1/destination/international-destination?search={{%20search_region%20}}&limit=99&offset=99',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'key: inputapikey'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://rajaongkir.komerce.id/api/v1/destination/international-destination?search={{%20search_region%20}}&limit=99&offset=99"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("key", "inputapikey")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://rajaongkir.komerce.id/api/v1/destination/international-destination?search={{ search_region }}&limit=99&offset=99',
headers: {
'key': 'inputapikey'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Query Parameterβ
Headersβ
Key | Type | Description |
---|---|---|
key * | string | this Value contain an secret APIKEY identic for Shipping Cost API |
Query Paramsβ
Key | Type | Description |
---|---|---|
search * | string | This parameter is used to search for the intended area, only can search the nation name. |
limit | int | The maximum number of rows (or records) to be returned by the query. |
offset | int | This is often used with LIMIT to limit query results in "pages" or "sections". |
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β
Key | Value (Description) |
---|---|
meta.message | Response for searching address. |
meta.code | Any response have different code. |
meta.status | Boolean status for checking address. |
data[].country_id | A uniqe id that is used as a parameter in the shipping cost. |
data[].country_name | Name of the search nation |
Success Respons for Search Internation Destinationβ
{
"meta": {
"message": "Success Get International Destination",
"code": 200,
"status": "success"
},
"data": [
{
"country_id": "{{ country_id }}",
"country_name": "{{ country_name }}"
}
]
}
Error Respons for Search International Destinationβ
{
"meta": {
"message": "International Destinations Data not found",
"code": 404,
"status": "error"
},
"data": null
}
Error Codeβ
Code | Status | Description | How to Fix |
---|---|---|---|
200 | Success | ||
404 | Error | International Destinations Data not found | Make sure the nation name you are looking for is correct. |
422 | Error | Parameter Missing | Make sure the required parameters are given when requesting data. |
500 | Error | Server Error |
Tips to Avoid Errorβ
- β
Provide a meaningful search
Avoid empty strings or irrelevant characters; use proper nation names. - π Include valid authorization
Always add yourkey
in the header. - β¨οΈ Implement frontend input validation
For best results, guide users to enter country names. - β οΈ Use debounce for live search
Prevent too many API calls by throttling or debouncing input. - π Gracefully handle βno resultsβ
Show friendly messages if the API returns an empty list due to unrecognized keywords.