API Documentation

Complete API reference for Bot API Service

🧪 Test API Endpoint

Base URL

https://bot2-sg.indoiix.com/

Authentication

All protected endpoints require API key authentication via header:

X-API-Key: your_api_key_here

Or using Bearer token: Authorization: Bearer your_api_key_here

Note: IP whitelisting is handled by Cloudflare. Contact admin to add your IP.

Kategori Produk (product_name / product_sku)

Yang boleh dipakai: Kamu boleh kirim salah satu: product_name atau product_sku. Nilainya harus persis sesuai mapping/whitelist.

Nominal: Hanya nominal yang sudah ada di mapping yang bisa diproses. Kalau nominal tidak ada di mapping, request gagal.

Contoh yang didukung (sesuai mapping/whitelist):

Voucher MD

1M - MD, 60M - MD, 100M - MD, 200M - MD, 400M - MD, 1B - MD, … 50B - MD

Atau 60M KOIN EMAS MD. Nominal M: 1–10, 15, 20, 30, 40, 50, 60, 100, 120, 200, 300, 400, 500, 600, 700, 800, 900. B: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 25, 30, 50, 100.

SKU lengkap (Voucher MD):

HDGIV1MHDGIV60MHDGIV100MHDGIV120MHDGIV200MHDGIV300MHDGIV400MHDGIV500MHDGIV600MHDGIV700MHDGIV800MHDGIV900MHDGIV1BHDGIV2BHDGIV3BHDGIV4BHDGIV5BHDGIV6BHDGIV7BHDGIV8BHDGIV9BHDGIV10BHDGIV20BHDGIV25BHDGIV30BHDGIV50BHDGIV100B

SKU baru (Voucher MD nominal kecil):

HDGI1MHDGI2MHDGI3MHDGI4MHDGI5MHDGI6MHDGI7MHDGI8MHDGI9MHDGI10MHDGI15MHDGI20MHDGI30MHDGI40MHDGI50M

Koin Emas D

100M KOIN EMAS D, 500M KOIN EMAS D, 1B KOIN EMAS D, dst.

Nominal M: 100–900. B: 1, 1.5, 2–10, 20, 25, 30, 50, 100.

SKU untuk kategori ini: belum disediakan (pakai product_name).

Tukar Kartu

Tukar Kartu (100M), Tukar Kartu (1B), … Tukar Kartu (10B)

Nominal M: 100–900. B: 1–10.

SKU lengkap (Tukar Kartu - legacy):

TKHU100TKHU200TKHU300TKHU400TKHU500TKHU600TKHU700TKHU800TKHU900TKHU1000TKHU1100TKHU1200TKHU1300TKHU1400TKHU1500TKHU1600TKHU1700TKHU1800TKHU1900

Catatan: TKHU1000=1B, TKHU1100=2B, … TKHU1900=10B.

SKU baru (Tukar Kartu):

TKXHU100MTKXHU200MTKXHU300MTKXHU400MTKXHU500MTKXHU600MTKXHU700MTKXHU800MTKXHU900MTKXHU1BTKXHU2BTKXHU3BTKXHU4BTKXHU5BTKXHU6BTKXHU7BTKXHU8BTKXHU9BTKXHU10B

Koleksi

Koleksi 100M, Koleksi 500M, Koleksi 1B

Nominal: 100M, 500M, 1B saja.

SKU lengkap (Koleksi):

K100MHDK500MHDK1BMHD

Ringkas: Pakai nama produk dan nominal yang ada di mapping. Tidak ada di mapping = gagal.

Kalau mau lihat list lengkap versi API (selalu up to date), pakai endpoint GET /api/v1/mitra/products.

API Endpoints

Tampilkan mode:

Mode — Manual Hit (Polling)

  1. Set cookies di /mitra/cookies
  2. Hit POST /api/v1/mitra/redeem → simpan order_id
  3. Cek status pakai GET /api/v1/mitra/orders/:orderId (atau history)

Mode ini cocok buat yang belum punya server webhook sendiri.

POST /api/register

Register new user and get API key (Public endpoint, no authentication required)

Request Body:

{
  "email": "user@example.com",
  "name": "User Name",
  "company": "Company Name"
}

Response (200 OK):

{
  "success": true,
  "message": "Registration successful...",
  "apiKey": "sk_live_abc123xyz789",
  "status": "pending"
}

Error Responses:

  • 400 - Email already registered
  • 400 - Invalid email format

POST /api/v1/mitra/redeem

Request redemption voucher. Order will be queued with status pending for bot Python to process.

Headers:

X-API-Key: your_api_key_here
Content-Type: application/json

Request Body:

Minimal: user_id + salah satu product_name/product_sku. Optional: quantity, client_trx_id, cookies.

{
  "user_id": "12345678",
  "product_name": "60M - MD",
  "quantity": 2,
  "client_trx_id": "TRX-CLIENT-001"
}

Atau pakai SKU:

{
  "user_id": "12345678",
  "product_sku": "HDGIV60M",
  "quantity": 2,
  "client_trx_id": "TRX-CLIENT-001"
}

Dev-only (1 call langsung setor cookies + redeem):

{
  "user_id": "12345678",
  "product_sku": "HDGIV60M",
  "quantity": 2,
  "client_trx_id": "TRX-CLIENT-001",
  "cookies": "cookie1=value1; cookie2=value2; ..."
}

Response (200 OK):

{
  "success": true,
  "message": "Redeem request received and queued for processing",
  "order_id": "ORD-1738012345678-abc123",
  "status": "pending",
  "user_id": "12345678",
  "product_name": "60M - MD",
  "product_sku": "HDGIV60M",
  "quantity": 2,
  "client_trx_id": "TRX-CLIENT-001"
}

Field product_sku muncul jika kamu kirim SKU.

Error Responses:

  • 401 - Invalid API key
  • 400 - Mitra cookie not configured
  • 400 - Mitra cookies expired
  • 400 - Missing user_id and (product_name or product_sku)
  • 400 - quantity must be 1..100

GET /api/v1/mitra/products

Get whitelist produk (list product_name dan product_sku yang valid). Ini yang harus kamu pakai kalau mau aman dari error mapping.

Headers:

X-API-Key: your_api_key_here

Response (200 OK):

{
  "success": true,
  "generated_at": "2026-01-29T00:00:00.000Z",
  "whitelist": {
    "product_sku": ["HDGIV60M", "TKHU100", "K100MHD", "..."],
    "product_name": ["60M - MD", "Tukar Kartu (100M)", "Koleksi 100M", "..."]
  },
  "categories": [
    {
      "key": "voucher_md",
      "accepts": { "product_name": true, "product_sku": true },
      "sku_prefix": "HDGIV",
      "product_sku": ["HDGIV60M", "HDGIV1B", "..."],
      "product_name": ["60M - MD", "1B - MD", "..."],
      "nominal": { "M": [60, 100, 120, 200, 300, 400, 500, 600, 700, 800, 900], "B": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 25, 30, 50, 100] }
    }
  ]
}

Gunakan list ini sebagai sumber data di client (dropdown / validasi) supaya tidak kirim produk yang tidak ada di mapping.

GET /api/v1/mitra/orders/:orderId

Check status of a specific order

Headers:

X-API-Key: your_api_key_here

Response (200 OK):

{
  "success": true,
  "order": {
    "order_id": "ORD-1738012345678-abc123",
    "user_id": "12345678",
    "product_name": "100M KOIN EMAS D",
    "status": "success",
    "error_message": null,
    "result": {
      "voucher_code": "ABC123XYZ",
      "redeemed_at": "2025-01-27T10:35:00.000Z"
    },
    "created_at": "2025-01-27T10:30:00.000Z",
    "updated_at": "2025-01-27T10:35:00.000Z",
    "processed_at": "2025-01-27T10:32:00.000Z",
    "completed_at": "2025-01-27T10:35:00.000Z"
  }
}

Error Responses:

  • 401 - Invalid API key
  • 404 - Order not found

GET /api/v1/mitra/orders/:orderId/history

Get order history (tracking semua perubahan status)

Headers:

X-API-Key: your_api_key_here

Response (200 OK):

{
  "success": true,
  "order_id": "ORD-1738012345678-abc123",
  "total": 4,
  "history": [
    {
      "id": "hist_xxx",
      "from_status": null,
      "to_status": "pending",
      "changed_by": "user",
      "notes": "Order created via API for user 12345678, product: 100M KOIN EMAS D",
      "metadata": null,
      "created_at": "2025-01-27T10:30:00.000Z"
    }
  ]
}

History Fields:

  • from_status - Status sebelumnya (null jika order baru)
  • to_status - Status baru
  • changed_by - Siapa yang ubah: user | bot | admin | system
  • notes - Catatan tambahan
  • metadata - Data tambahan (result_data, dll)
  • created_at - Timestamp perubahan

Error Responses:

  • 401 - Invalid API key
  • 403 - Order does not belong to this user
  • 404 - Order not found

GET /api/v1/mitra/orders

List all orders with pagination

Query Parameters:

  • status (optional) - Filter by status: pending, processing, success, failed, cancelled
  • limit (optional) - Items per page (default: 20, max: 100)
  • offset (optional) - Pagination offset (default: 0)

Example Request:

GET /api/v1/mitra/orders?status=pending&limit=10&offset=0

Response (200 OK):

{
  "success": true,
  "total": 25,
  "limit": 10,
  "offset": 0,
  "orders": [
    {
      "order_id": "ORD-xxx",
      "user_id": "12345678",
      "product_name": "100M KOIN EMAS D",
      "status": "pending",
      "created_at": "2025-01-27T10:30:00.000Z",
      ...
    }
  ]
}

GET /api/v1/mitra/cookies

Check Mitrahiggs cookies status

Response (200 OK):

{
  "success": true,
  "has_cookies": true,
  "is_expired": false,
  "expires_at": "2025-02-26T10:30:00.000Z"
}

POST /api/v1/mitra/cookies

Set/update Mitrahiggs cookies

Request Body:

{
  "cookies": "session_id=abc123; csrf_token=xyz789; user_id=12345678"
}

Response (200 OK):

{
  "success": true,
  "message": "Cookies saved successfully",
  "expires_at": "2025-02-26T10:30:00.000Z"
}

Note: You can also set cookies via web interface at /mitra/cookies

Order Status

  • pending - Order baru dibuat, menunggu diproses bot Python
  • processing - Bot Python sedang memproses order
  • success - Order berhasil diproses
  • failed - Order gagal diproses (cek error_message)
  • cancelled - Order dibatalkan

HTTP Status Codes

CodeDescription
200Success
400Bad Request - Invalid input or missing required fields
401Unauthorized - Invalid API key or user not active
403Forbidden - IP not whitelisted (Cloudflare)
404Not Found - Resource not found
500Internal Server Error - Server error

Complete Workflow Example

1. Register User:

curl -X POST https://bot2-sg.indoiix.com/api/register \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "name": "John Doe"}'

2. Set Cookies (via Web):

Visit /mitra/cookies and set your Mitrahiggs cookies

3. Request Redemption:

curl -X POST https://bot2-sg.indoiix.com/api/v1/mitra/redeem \
  -H "X-API-Key: sk_live_abc123xyz789" \
  -H "Content-Type: application/json" \
  -d '{"user_id": "12345678", "product_name": "100M KOIN EMAS D"}'

4. Check Order Status:

curl -X GET https://bot2-sg.indoiix.com/api/v1/mitra/orders/ORD-xxx \
  -H "X-API-Key: sk_live_abc123xyz789"

Important Notes

IP Whitelist: Untuk test protected endpoints, contact admin untuk IP whitelist

• IP whitelisting is managed manually by admin in Cloudflare

• You must set Mitrahiggs cookies before requesting redemption

• Cookies expire after 30 days (you need to update them)

• Order status changes: pending → processing → success/failed

• Bot Python polls for pending orders and processes them asynchronously