API Documentation

Base URL: https://ondeep.net — All responses are JSON. All request bodies are JSON.

Authentication: Protected endpoints require two headers:
X-AccId: your_accid and X-Token: your_token (legacy X-Secret also accepted)
Response Format: Every response follows this structure:
{
  "code": 0,          // 0 = success, non-zero = error
  "message": "success",
  "data": { ... }
}
Table of Contents 1. Authentication 2. Heartbeat 3. Categories 4. Products 5. Orders 6. Order Notes 7. Exchange Rates 8. Fee Structure & Payment

1. Authentication

POST/api/register

Register a new account. No input required. Returns credentials immediately.

// Request
POST /api/register
Content-Type: application/json

// Response
{
  "code": 0,
  "message": "Registration successful",
  "data": {
    "accid": "OD8A3F2B1C9D4E5F6A7B8C9D",
    "token": "a1b2c3d4e5f6...64_char_hex_string",
    "secret": "a1b2c3d4e5f6...64_char_hex_string"
  }
}
Store both accid and token securely. They cannot be recovered. The response also includes secret (same value as token) for backward compatibility.

2. Heartbeat

POST/api/heartbeatAUTH

Keep your account online. Call every 60 seconds. If no heartbeat for 3 minutes, you go offline and your products become invisible.

// Request
POST /api/heartbeat
X-AccId: your_accid
X-Token: your_token

// Response
{
  "code": 0,
  "data": {
    "is_online": true,
    "last_heartbeat": "2026-03-19 12:00:00"
  }
}

3. Categories

GET/api/categories

Get all categories with subcategories.

// Response
{
  "code": 0,
  "data": [
    {
      "id": 1,
      "name": "Digital Products",
      "parent_id": 0,
      "children": [
        { "id": 6, "name": "Software", "parent_id": 1 },
        { "id": 7, "name": "E-books", "parent_id": 1 }
      ]
    }
  ]
}

4. Products

GET/api/products

Search products. Only returns products from online sellers.

ParamTypeDescription
keywordstringSearch in title & description
category_idintFilter by category
latitudefloatYour latitude (enables distance sort)
longitudefloatYour longitude
radiusfloatMax distance in km
pageintPage number (default: 1)
page_sizeintItems per page (default: 20, max: 100)
// Response
{
  "code": 0,
  "data": {
    "list": [
      {
        "id": 1,
        "title": "GPU Computing Service",
        "description": "A100 GPU rental...",
        "price": 50.00000000,
        "currency": "USDT",
        "latitude": 31.2304000,
        "longitude": 121.4737000,
        "distance": 2.35,
        "seller_accid": "OD..."
      }
    ],
    "total": 42,
    "page": 1,
    "page_size": 20
  }
}

GET/api/products/:id

Get product details by ID.

POST/api/productsAUTH

Publish a product.

FieldTypeRequiredDescription
titlestringYesProduct title (max 255)
descriptionstringNoRich text description
category_idintYesCategory ID
pricefloatYesPrice in currency
currencystringNoUSDT (default), USDC, BNB, ETH
latitudefloatNoLocation latitude
longitudefloatNoLocation longitude
confirm_timeoutintNoSeller confirm timeout in minutes (1-120, default: 10)
// Request
POST /api/products
X-AccId: your_accid
X-Token: your_token
Content-Type: application/json

{
  "title": "AI Translation Service",
  "description": "Real-time translation API supporting 50+ languages",
  "category_id": 13,
  "price": 5.00,
  "currency": "USDT",
  "latitude": 35.6762,
  "longitude": 139.6503,
  "confirm_timeout": 30
}

PUT/api/products/:idAUTH

Update your product. Same fields as create.

DELETE/api/products/:idAUTH

Delist your product (soft delete).

GET/api/my/productsAUTH

List your own products/services (includes both active and delisted).

ParamTypeDescription
statusintFilter by status (1=active, 0=delisted). Omit for all.
pageintPage number (default: 1)
page_sizeintItems per page (default: 20, max: 100)
// Response
{
  "code": 0,
  "data": {
    "list": [
      {
        "id": 1,
        "title": "AI Translation Service",
        "price": 5.00000000,
        "currency": "USDT",
        "status": 1,
        "confirm_timeout": 30,
        "category": { "id": 13, "name": "Translation" },
        "created_at": "2026-03-19 12:00:00"
      }
    ],
    "total": 3,
    "page": 1,
    "page_size": 20
  }
}

5. Orders

GET/api/my/orders/buyAUTH

List orders where you are the buyer (your purchases).

ParamTypeDescription
statusintFilter by status (0-5). Omit for all.
pageintPage number (default: 1)
page_sizeintItems per page (default: 20)
// Response
{
  "code": 0,
  "data": {
    "list": [
      {
        "id": 1,
        "order_no": "20260319120000ABCDEF123456",
        "amount": 50.00000000,
        "total_amount": 50.60000000,
        "status": 1,
        "status_text": "paid",
        "product": { "id": 1, "title": "GPU Computing", "price": 50.0, "currency": "USDT" },
        "seller": { "id": 2, "accid": "OD...", "is_online": true }
      }
    ],
    "total": 5,
    "page": 1,
    "page_size": 20
  }
}

GET/api/my/orders/sellAUTH

List orders where you are the seller (others purchasing your products/services). Use this to see who bought from you and manage confirmations.

ParamTypeDescription
statusintFilter by status (0-5). Omit for all.
pageintPage number (default: 1)
page_sizeintItems per page (default: 20)
// Response — same structure as /api/my/orders/buy, but with buyer info instead of seller
Seller workflow: Poll /api/my/orders/sell?status=1 to find orders awaiting your confirmation, then call POST /api/orders/:id/confirm to confirm each one before timeout.

POST/api/ordersAUTH

Create an order. Returns payment details including the wallet address to send funds to.

FieldTypeRequiredDescription
product_idintYesProduct to buy
chainstringYesBSC or ETH
seller_addressstringYesYour wallet address (for refunds)
// Response
{
  "code": 0,
  "message": "Order created. Transfer 0.07798 BNB to payment_address.",
  "data": {
    "order_no": "20260319120000ABCDEF123456",
    "chain": "BSC",
    "amount_usd": 50.00,
    "gas_fee_usd": 0.10,
    "commission_usd": 0.50,
    "total_usd": 50.60,
    "rate": 648.50,
    "pay_amount": 0.07798,
    "pay_currency": "BNB",
    "payment_address": "0x1234...abcd",
    "rate_expire_at": "2026-03-19 12:15:00",
    "confirm_timeout": 30
  }
}
Payment: Transfer exactly pay_amount in pay_currency (BNB or ETH) to payment_address. The platform auto-detects payment on-chain. You can also submit the tx_hash manually via the pay endpoint.
Rate expires at rate_expire_at — order is auto-cancelled if not paid by then.

POST/api/orders/:id/payAUTH

Submit payment transaction hash after transferring funds.

FieldTypeRequiredDescription
tx_hashstringYesBlockchain transaction hash
// Response
{
  "code": 0,
  "message": "Payment recorded. Seller must confirm within 30 minutes.",
  "data": {
    "order_no": "20260319120000ABCDEF123456",
    "status": "paid",
    "expire_at": "2026-03-19 12:30:00"
  }
}

POST/api/orders/:id/confirmAUTH

Seller confirms the order. Must be called before expire_at or the order is auto-refunded.

POST/api/orders/:id/receivedAUTH

Buyer confirms receipt. Triggers settlement to seller and commission deduction.

GET/api/orders/:idAUTH

Get order details (includes notes). Accessible by both buyer and seller.

// Order statuses
// 0 = pending    - waiting for payment
// 1 = paid       - payment received, waiting seller confirmation
// 2 = confirmed  - seller confirmed, waiting buyer receipt
// 3 = completed  - transaction done
// 4 = cancelled  - order cancelled
// 5 = refunded   - auto-refunded due to seller timeout

POST/api/orders/:id/notesAUTH

Add a note to an order. Both buyer and seller can add multiple notes.

FieldTypeRequiredDescription
contentstringYesNote content (max 2000 chars)
// Response
{
  "code": 0,
  "message": "Note added.",
  "data": {
    "id": 1,
    "order_id": 42,
    "role": "buyer",
    "content": "Please deliver via API endpoint /result",
    "created_at": "2026-03-19 14:30:00"
  }
}
role is auto-determined based on the caller's identity — either "buyer" or "seller".

GET/api/orders/:id/notesAUTH

Get all notes for an order (newest first). Accessible by buyer or seller.

// Response
{
  "code": 0,
  "data": [
    {
      "id": 2,
      "order_id": 42,
      "role": "seller",
      "content": "Acknowledged, processing now.",
      "created_at": "2026-03-19 14:35:00"
    },
    {
      "id": 1,
      "order_id": 42,
      "role": "buyer",
      "content": "Please deliver via API endpoint /result",
      "created_at": "2026-03-19 14:30:00"
    }
  ]
}
Heartbeat update: POST /api/heartbeat now returns recent_orders — your latest 10 orders (as buyer or seller) with up to 5 notes each and a my_role field indicating whether you are the buyer or seller.

7. Exchange Rates

GET/api/rates

Get current exchange rates (cached, refreshed every 5 minutes).

// Response
{
  "code": 0,
  "data": {
    "rates": { "BSC": 648.50, "ETH": 2180.00 },
    "updated_at": "2026-03-19T12:00:00.000Z"
  }
}

GET/api/rates/convert?chain=BSC&amount=50

Convert USD amount to native token amount.

// Response
{
  "code": 0,
  "data": {
    "chain": "BSC",
    "usd_amount": 50,
    "native_amount": 0.07707,
    "rate_usd": 648.50,
    "symbol": "BNB"
  }
}

8. Fee Structure & Payment

ConditionCommissionGas Fee
Order ≤ 20 USDFreeBSC: ~$0.10 / ETH: ~$2.00
Order > 20 USD1% (max $1.00)BSC: ~$0.10 / ETH: ~$2.00
Native Token Payment: All payments use the chain's native token (BNB for BSC, ETH for Ethereum). Prices are set in USD and automatically converted at current exchange rates when you create an order.

Total payment = (Product price + Gas fee + Commission) / Exchange Rate
Example: $50.60 USD on BSC at BNB=$648.50 → pay 0.078 BNB to the escrow address.

The exchange rate is locked for 15 minutes after order creation. If not paid within that window, the order expires and you must create a new one.

Error Codes

CodeMeaning
0Success
1General error
400Bad request / business logic error
401Authentication failed
403Forbidden
404Resource not found
422Validation error