Search Destination
This API allows users to search for destination addresses based on a keyword. It returns a list of addresses matching the provided keyword.
Overview
The Search Destination Endpoint is designed to provide a fast and accurate way to find locations within the shipping system. This endpoint supports searching for various administrative levels, including:
- City
- District
- Sub-District
- Postal Code
By integrating this endpoint, users can easily retrieve precise location details without manually mapping regional hierarchies. This ensures greater flexibility and accuracy in defining both origin and destination areas.
Key Features
✅ Comprehensive Location Search – Supports multi-level search from provinces to sub-districts.
✅ Optimized for Efficiency – Fast response times without additional processing on the user’s side.
✅ Seamless Logistics Integration – Ensures accurate regional mapping for shipping cost calculations.
✅ Error Minimization – Reduces inconsistencies caused by mismatched regional data structures.
How it Works
The Search Destination Endpoint streamlines the process of finding and selecting locations within a shipping workflow. Instead of requiring users to manually filter through Province → City → District → Sub-district, the system automates the search and presents relevant location options based on input criteria.
Automatic Location Hierarchy Processing
- Users can input search queries using City, District, Sub-district, or Postal Code.
- The system automatically maps and retrieves related location data without additional configuration.
Precise & Reliable Data Retrieval
- The response includes region IDs corresponding to the searched origin or destination.
- Users receive a structured JSON response containing multiple location options to select from.
Seamless Transaction to Cost Calculation
- Once a user selects a location, the region ID can be used in the Calculate Endpoint for shipping cost estimation.
- This workflow ensures smooth data transition from location selection to shipping fee calculation.
Request Body
- cURL
- JavaScript
- PHP
- GoLang
- NodeJS
curl --location 'https://api-sandbox.collaborator.komerce.id/tariff/api/v1/destination/search?keyword=%2F%2Finput-location%2F%2F' \
--header 'x-api-key: //inputapikey//'
const myHeaders = new Headers();
myHeaders.append("x-api-key", "inputapikey");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://api-sandbox.collaborator.komerce.id/tariff/api/v1/destination/search?keyword=//input-location//", 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://api-sandbox.collaborator.komerce.id/tariff/api/v1/destination/search?keyword=%2F%2Finput-location%2F%2F',
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(
'x-api-key: inputapikey'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.collaborator.komerce.id/tariff/api/v1/destination/search?keyword=%2F%2Finput-location%2F%2F"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("x-api-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://api-sandbox.collaborator.komerce.id/tariff/api/v1/destination/search?keyword=//input-location//',
headers: {
'x-api-key': 'inputapikey'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Query Parameter
Headers
Key | Type | Description |
---|---|---|
x-api-key * | string | this Value contain an secret APIKEY identic for Shipping API |
Query Parameters
Key | Type | Description |
---|---|---|
keyword * | string | This parameter can be used to search for districts/subdistricts/villages/postcodes. |
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.id | Unique data for location |
data.label | Full information about location |
data.subdistrict_name | Information about searching Subdistrict |
data.district_name | Information about searching District |
data.city_name | Information about searching City |
data.province_name | Information about searching Province |
data.zip_code | Information about searching Postal Code |
Success Respons for Creating an Order
{
"meta": {
"message": "Sucessfully Get Destination Data",
"code": 200,
"status": "success"
},
"data": [
{
"id": 99999,
"label": "SUBDISTRICT, DISTRICT, CITY, POSTALCODE",
"subdistrict_name": "SUBDISTRICT",
"district_name": "DISTRICT",
"city_name": "CITY",
"province_name": "PROVINCE",
"zip_code": "POSTALCODE"
}
]
}
Error Respons for Creating an Order
{
"meta": {
"message": "Sucessfully Get Destination Data",
"code": 200,
"status": "success"
},
"data": []
}
Our system may give a response as above because the actual search was successful, but the data being searched was not found, so the response will still be successful but will not show the data.
Error Code
Code | Status | Description | How to Fix |
---|---|---|---|
401 | Unauthorized | API key invalid or missing from parameter | Make sure your API key is valid using your Account |
422 | Unprocessable Entity | Keywoard parameter is missing | Add an valid keywoard parameter in your requested query. Parameter Request can't be null or missing |
500 | - | - | - |
Tips to Avoid Errors
- Always include the Authorization header with a valid token.
- Do not leave the keyword parameter empty — it’s required.
- Use the correct endpoint and query structure.
If you’re building a client or integrating this API, make sure to validate inputs on the frontend before sending the request. Let me know if you want help writing that validation!