Search Domestic Destination

Overview

The Search Domestic Destination endpoint allows you to retrieve destination data for domestic shipments using the RajaOngkir integration. This is typically used to populate dropdowns or validate destination locations before calculating shipping costs or creating shipments.

It supports searching by value (

city
,
district
,
subdistrict
, or
zip_code
) and is essential for ensuring accurate shipping data entry in e-commerce platforms and logistics systems.

Key Feature

  • βœ… Real-time destination lookup
    Instantly retrieve location data across Indonesia based on value params.

  • πŸ“ Multi-level location support
    Returns province, city, district, subdistrict, and zip code information in a single query.

  • πŸ”Ž Flexible search
    Search using partial names or keywords β€” ideal for autocomplete fields.

  • ⚑ Optimized for performance
    Lightweight endpoint designed to be used on page loads or form interactions.

How it Works

  1. Send a POST request to the endpoint with a

    search
    payload:

    • This keyword may include city names like
      "jakarta"
      or
      "bandung"
      , or subdistricts like
      "kemayoran"
      .
  2. The API returns a list of matched locations based on the keyword:

    • Each result includes
      id
      ,
      label
      ,
      province
      ,
      city
      ,
      district
      ,
      subdistrict
      , and
      zip_code
      .
  3. Use the returned

    id
    when calculating shipping cost.

Request Body

curl --location 'https://rajaongkir.komerce.id/api/v1/destination/domestic-destination?search={{search_location}}&limit=999&offset=999' \ --header 'key: inputapikey'

Query Parameter

Headers

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

Query Params

KeyTypeDescription
search
*
stringThis parameter is used to search for the intended area, can use the search for city names, sub-districts, villages, and postal codes.
limit
intThe maximum number of rows (or records) to be returned by the query.
offset
intThis is often used with LIMIT to limit query results in "pages" or "sections".

:::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.message
Response for searching address.
meta.code
Any response have different code.
meta.status
Boolean status for checking address.
data[].id
A uniqe
id
that is used as a parameter in the shipping cost.
data[].label
Full format for delivery location.
data[].province_name
Name of the search province
data[].city_name
Name of the search city
data[].district_name
Name of the search district
data[].subdistrict_name
Name of the search subdistrict
data[].zip_code
Name of the search zip code

Success Respons for Search Domestics Destination

{ "meta": { "message": "Success Get Domestic Destinations", "code": 200, "status": "success" }, "data": [ { "id": {{ id_location }}, "label": "{{ label_location }}", "province_name": "{{ province_location }}", "city_name": "{{ city_location }}", "district_name": "{{ distric_location }}", "subdistrict_name": "{{ subdistrict_location }}", "zip_code": "{{ zipcode_location }}" } ] }

Error Respons for Search Domestic Destination

{ "meta": { "message": "Domestic Destinations Data not found", "code": 404, "status": "error" }, "data": null }

Error Code

CodeStatusDescriptionHow to Fix
200
Success
404
ErrorDomestic Destinations Data not foundMake sure the name of the city, sub-district, village, or zip code you are looking for is correct.
422
ErrorParameter MissingMake sure the required parameters are given when requesting data.
500
ErrorServer Error

Tips to Avoid Error

  • βœ… Always validate the value input
    Ensure it is a non-empty string. Avoid sending numeric or symbol-only strings.
  • πŸ” Debounce user input on the frontend
    If you’re using this for search-as-you-type, add a debounce delay to reduce API calls.
  • πŸ“¦ Cache popular destination results
    For performance improvement, cache results for frequent searches (like β€œJakarta”).
  • ❌ Avoid calling the endpoint without a request location
    Requests with an empty or missing request will return an error or no data.
  • πŸ” Set the Key header
    Don’t forget to include your APIKEY in the header.