Dokumentasi lengkap penggunaan API untuk cek ongkir dan lokasi.
Digunakan untuk mendapatkan area_id yang diperlukan untuk proses hitung ongkir.
| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
input |
String | Ya | Nama daerah, kota, atau kode pos (min. 3 karakter). |
type |
String | Tidak | Default: single. Gunakan double untuk pencarian lebih luas.
|
curl -X GET "https://api-ongkir.pages.dev/api/search-lokasi?input=umbulharjo"
{
"success": true,
"areas": [
{
"id": "IDNP5IDNC488IDND6359IDZ55161",
"name": "Umbulharjo, Yogyakarta, DI Yogyakarta. 55161",
"postal_code": 55161,
...
}
]
}
Menghitung biaya pengiriman berdasarkan kurir yang tersedia.
{
"origin_postal_code": 55161,
"destination_postal_code": 12420,
"couriers": "jne,sicepat,anteraja,jnt",
"items": [
{
"weight": 1000,
"length": 1,
"width": 1,
"height": 1
}
]
}
| Field | Deskripsi |
|---|---|
origin_postal_code |
Kode pos asal (Integer). |
destination_postal_code |
Kode pos tujuan (Integer). |
couriers |
Daftar kurir dipisah koma. |
items |
Array objek berisi detail berat (gram) dan dimensi (cm). |
jne, sicepat, anteraja, wahana, rpx, idexpress, jdl, lion, tiki, jnt, ninja, sap, pos
curl -X POST "https://api-ongkir.pages.dev/api/cek-ongkir" \
-H "Content-Type: application/json" \
-d '{
"origin_postal_code": 55161,
"destination_postal_code": 12420,
"couriers": "jne,sicepat",
"items": [{ "weight": 1000, "length": 10, "width": 10, "height": 10 }]
}'
Proxy ke Google Places Autocomplete untuk pencarian lokasi (Instant Courier).
| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
q |
String | Ya | Kata kunci pencarian lokasi (min. 3 karakter). |
curl -X GET "https://api-ongkir.pages.dev/api/search-lokasi-instant?q=Monas"
{
"results": [
{
"id": "ChIJMwPfYKfxaS4R1xww8mD-jkw",
"text": "Monas, Gambir, Central Jakarta City, Jakarta, Indonesia",
"structured_formatting": {
"main_text": "Monas",
"secondary_text": "Gambir, Central Jakarta City, Jakarta, Indonesia"
}
}
]
}
Proxy ke Google Places Details untuk mendapatkan koordinat (latitude/longitude).
| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
place_id |
String | Ya | ID lokasi dari hasil autocomplete. |
curl -X GET "https://api-ongkir.pages.dev/api/detail-lokasi-instant?place_id=ChIJMwPfYKfxaS4R1xww8mD-jkw"
{
"result": {
"geometry": {
"location": {
"lat": -6.1753924,
"lng": 106.8271528
}
},
"name": "Monas",
"formatted_address": "Gambir, Central Jakarta City, Jakarta, Indonesia"
},
"status": "OK"
}
Cek tarif khusus kurir instan (Gojek/Grab) via Biteship.
{
"origin_latitude": -6.175392,
"origin_longitude": 106.827153,
"destination_latitude": -6.208763,
"destination_longitude": 106.845599,
"couriers": "gojek,grab",
"items": [{
"length": 10,
"width": 10,
"height": 10,
"weight": 1000
}]
}
| Field | Deskripsi |
|---|---|
origin_latitude |
Latitude lokasi asal. |
origin_longitude |
Longitude lokasi asal. |
destination_latitude |
Latitude lokasi tujuan. |
destination_longitude |
Longitude lokasi tujuan. |
couriers |
Kurir: gojek,grab. |
items |
Array dimensi dan berat barang. |
curl -X POST "https://api-ongkir.pages.dev/api/cek-ongkir-instant" \
-H "Content-Type: application/json" \
-d '{
"origin_latitude": -6.175392,
"origin_longitude": 106.827153,
"destination_latitude": -6.208763,
"destination_longitude": 106.845599,
"couriers": "gojek,grab",
"items": [{ "length": 10, "width": 10, "height": 10, "weight": 1000 }]
}'
{
"success": true,
"object": "courier_pricing",
"pricing": [
{
"company": "gojek",
"courier_name": "GoSend",
"courier_service_name": "Instant",
"duration": "1-2 jam",
"price": 20000,
...
}
]
}