rajaongkir

RajaOngkir Authorization

Overview

To interact with the RajaOngkir API, you must authenticate your requests using an APIKEY. This key is a unique identifier issued to your account and is required in every request to verify your identity and grant access to the appropriate resources.

Without this key, the system will reject your request with a 401 Unauthorized error.

Where to Find Your API Key

Follow these steps to locate your API key:

  1. Login to your Collaborator Dashboard
  2. Navigate to the Integration menu
  3. Click on Api Key
  4. You'll find Shipping Cost APIKEY
    • Do not use API keys intended for other services (e.g. Shipping Delivery, etc.)

:::โš ๏ธ Important: Treat your APIKEY like a password. Never share it or expose it publicly (e.g., in GitHub repos or front-end code). :::

How to Use APIKEY

Include your API key as a Middleware in the HEADER of each API request:

key: YOUR_API_KEY

Example Request with cURL

curl --request GET \
  --url https://rajaongkir.komerce.id/api/v1
  --header 'key: YOUR_API_KEY'

This will return the list of available couriers for your checking cost and history AWB.

Best Practices

โœ… Keep it secret: Never expose your API Key in frontend apps.
๐Ÿ” Rotate regularly: Periodically regenerate keys to enhance security.
๐Ÿงช Use sandbox for testing: Always use the test key before going live.
๐Ÿ”Ž Log usage: Monitor API activity to prevent abuse or quota overages.
๐Ÿ” Refresh keys if compromised: Immediately revoke and generate a new one.