Order History

Retrieve paginated order history with date and status filters.

Returns your paginated order history with optional date range and status filters. Ideal for reconciliation, dashboards, and audit trails.

Endpoint

GET/api/v1/orders

Request Headers

Headers

ParameterTypeRequiredDescription
X-Api-KeyStringYesYour API Key.
X-TimestampStringYesCurrent Unix timestamp in ms.
X-SignatureStringYesHMAC-SHA256 signature. Sign timestamp only.

Query Parameters

Query Params

ParameterTypeRequiredDescription
pageNumberNoPage number (1-based, default: 1).
limitNumberNoItems per page (1-100, default: 50).
statusStringNoFilter: pending, processing, success, failed, refunded. processing also returns a pre-order you placed from your dashboard that waits for its delivery date.
start_dateStringNoStart date (YYYY-MM-DD), from 00:00 UTC.
end_dateStringNoEnd date (YYYY-MM-DD), through 23:59:59 UTC. Max 90-day range.

90-Day Maximum

Date range cannot exceed 90 days.

Response

200OK
json
{
"success": true,
"data": {
  "orders": [
    {
      "order_id": "AG2026100648291057",
      "ref_id": "R-12345",
      "product_code": "ALGAN-MLBB-86",
      "product_name": "Mobile Legends 86 Diamonds",
      "target_id": "12345678",
      "zone_id": "1234",
      "price": 25000,
      "status": "success",
      "message": "Order completed",
      "serial_number": "ALG-A1B2C3D4EF",
      "created_at": "2026-05-14T10:30:00.000Z",
      "completed_at": "2026-05-14T10:30:05.123Z",
      "failure_code": null,
      "failure_reason": null,
      "refunded_amount": null,
      "quantity": 1,
      "units": [],
      "deliver_at": null
    },
    {
      "order_id": "b4c5d6e7-...",
      "ref_id": "R-12346",
      "product_code": "ALGAN-MLBB-86",
      "product_name": "Mobile Legends 86 Diamonds",
      "target_id": "87654321",
      "zone_id": "1234",
      "price": 25000,
      "status": "failed",
      "message": "Order failed",
      "serial_number": null,
      "created_at": "2026-05-14T10:31:00.000Z",
      "completed_at": "2026-05-14T10:31:03.402Z",
      "failure_code": "PRODUCT_UNAVAILABLE",
      "failure_reason": "The order was rejected: product not found",
      "refunded_amount": 25000,
      "quantity": 1,
      "units": [],
      "deliver_at": null
    }
  ]
},
"meta": {
  "total": 156,
  "page": 1,
  "limit": 50,
  "total_pages": 4,
  "has_more": true
}
}

Field Behavior

Notes

ParameterRequiredDescription
order_idNoThe order id, always a string. Orders placed from the 2026-10 switch-on get a short order number: AG + order date (YYYYMMDD, Asia/Jakarta) + 8 digits, e.g. AG2026100648291057. Orders placed before keep their UUID forever. Treat it as opaque text of up to 36 characters; never validate it as a UUID.
serial_numberNoOnly populated when status = "success". Null otherwise.
completed_atNoSet only for terminal states (success/failed/refunded). Stamped once, at the moment the order reached its final state, and never moved afterwards; callback delivery and retries no longer shift it. Rows completed before this change carry an approximate value.
messageNoGeneric status sentence. Wording is unchanged and stable.
failure_codeNoNEW: stable failure category, or null. Same vocabulary as GET /order-status; see that page for the list. Treat it as an open set.
failure_reasonNoNEW: a human-readable sentence you can show your customer, or null. Never names our upstream provider.
refunded_amountNoMoney returned to your balance for this order (whole price on a full refund, the failed items' share on a partly delivered combo or bundle). Null when nothing was refunded.
quantityNoNEW: number of items in the order. Always 1 for an ordinary product; the item count for a combo.
unitsNoNEW: per-item progress of a combo order; [] for an ordinary product. Same shape as GET /order-status, see Combo Orders there.
deliver_atNoNEW: for a pre-order you placed from your reseller dashboard, the promised delivery time (ISO 8601, nullable). The order reads status "processing" until it is delivered on that date. Null for every other order.

Finding out why orders failed

GET /orders?status=failed now returns the reason for each failure inline, so you can reconcile a whole day of failures in one call instead of chasing them individually.

Polling Open Orders in One Call

Callbacks are the cheapest way to learn that an order finished (see Callbacks). If you poll instead, ask for all your open orders at once rather than calling GET /order-status once per order:

GET /api/v1/orders?status=processing&limit=100

Read further pages with page=2, page=3, … while meta.has_more is true. An order you placed that is no longer on this list has finished: find it with status=success or status=failed, or read it with one GET /order-status?ref_id=....

Requests per sweep

ParameterRequiredDescription
One GET /order-status per open orderNoOne request per open order: 250 open orders cost 250 requests.
GET /orders?status=processing&limit=100NoOne request per 100 open orders: 250 open orders cost 3 requests.

Every request counts against your tier’s per-minute limit (see Rate Limits), so this keeps a busy integration well under it. A pre-order you placed from your dashboard stays on the processing list until it is delivered on its date (its deliver_at says when).

Example cURL

API_KEY="algan_live_..."
API_SECRET="sk_live_..."
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(echo -n "${TIMESTAMP}" | \
  openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')

curl -s "https://algan.id/api/v1/orders?page=1&limit=10&status=success" \
  -H "X-Api-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Signature: ${SIGNATURE}"

Example (Node.js)

const crypto = require('crypto');
const API_KEY = 'algan_live_...';
const API_SECRET = 'sk_live_...';
const timestamp = Date.now().toString();
const signature = crypto.createHmac('sha256', API_SECRET).update(timestamp).digest('hex');

const params = new URLSearchParams({ status: 'failed', page: '1', limit: '20' });
const res = await fetch(`https://algan.id/api/v1/orders?${params}`, {
  headers: { 'X-Api-Key': API_KEY, 'X-Timestamp': timestamp, 'X-Signature': signature },
});
const data = await res.json();

Error Responses

Possible Errors

ParameterTypeRequiredDescription
INVALID_PAGINATION400Nopage ≥ 1, limit 1-100.
INVALID_DATE_RANGE400NoInvalid date format or end before start.
INVALID_STATUS_FILTER400NoInvalid status value.
PreviousOrder StatusNextBalance