3 min read

Cek Resi Indonesia API

Cek Resi Indonesia API is a lightweight API for tracking shipment numbers from Indonesian courier services. It returns tracking information as JSON, including the courier name, shipment status, receiver information, and package journey history.

The project was built as a practical API and scraping exercise, combining a small HTTP framework with HTML fetching and parsing utilities.

Overview

The API exposes a tracking endpoint under /cek-resi/:noresi. Given a shipment number, the service attempts to retrieve shipment data and normalize the result into a response that is easier to consume from another application.

It supports courier services commonly used in Indonesia, including JNE, J&T, SiCepat, POS Indonesia, Ninja Xpress, Anteraja, Lion Parcel, Paxel, SAP Express, Lazada Express, JDL Express, and others that can be added as needed.

Problem

Shipment tracking data is often spread across different courier websites, each with its own layout and response format. That makes it inconvenient to integrate tracking information into a custom dashboard, internal tool, or customer-facing application.

The goal of this project was to create a simple API layer that turns shipment tracking into a predictable JSON response.

Role

I designed and implemented the API endpoint, request flow, scraping logic, HTML parsing, and response structure.

The project also includes basic setup documentation so it can be cloned, installed, run locally, and tested through curl or an API client.

Stack

  • Hono for the HTTP API framework
  • Axios for making HTTP requests
  • Cheerio for parsing HTML responses
  • Node.js for the runtime

Features

  • Track shipment numbers through a single endpoint
  • Return shipment details as JSON
  • Include courier name, shipment number, sender, destination, status, receiver, and delivery date
  • Include package journey history when available
  • Provide a root endpoint for basic API health and usage information
  • Keep the implementation small enough to understand and extend

API Design

The API keeps the route structure intentionally simple:

MethodEndpointPurpose
GET/Return basic API information
GET/cek-resi/:noresiTrack a shipment number

The tracking response is shaped around the shipment itself, with a valid flag and a nested data object for the parsed shipment details.

Response Data

A successful tracking response may include:

  • expedisi
  • noResi
  • pengirim
  • tujuan
  • status
  • tanggalKirim
  • penerima
  • perjalanan

The perjalanan field contains the shipment timeline, with each entry storing a timestamp and tracking description.

Implementation Notes

This API depends on external courier web pages and the HTML structure they expose. Axios is used to fetch the source page, while Cheerio is used to parse the relevant shipment fields from the returned HTML.

Because the parser depends on third-party page structure, the scraper may need updates when a courier changes its markup. For that reason, this project is best treated as a personal or development API rather than a guaranteed production integration.

Outcome

The result is a compact shipment tracking API that demonstrates Hono routing, HTTP fetching, HTML parsing, and JSON response normalization.

It can be used as a learning project, a base for an internal tracking tool, or a starting point for a more complete logistics dashboard with validation, caching, error handling, and courier-specific adapters.