API Endpoints

Endpoints ทั้งหมดที่มีให้บริการ

Base URL

โปรดักชัน: https://api.usdtlowfee.com

กฎทั่วไป

หน่วย

  • • sun: 1 TRX = 1,000,000 sun (ฟิลด์ค่าทั้งหมดใช้ sun)
  • • energyValue: หน่วยพลังงาน (ตัวเลข int64)
  • • durationHours: ชั่วโมง (ตัวเลข int)

ประเภทข้อมูล

  • • ฟิลด์ ID: ตัวเลข int64 (snowflake ID)
  • • ฟิลด์ค่า: ตัวเลข int64 (ลงท้ายด้วย *Sun เช่น: balanceSun, priceSun)
  • • ฟิลด์เวลา: string (รูปแบบ ISO8601 UTC เช่น: "2025-01-15T10:30:00Z")
  • • ฟิลด์ Boolean: true/false

รูปแบบการตอบกลับ

  • • สำเร็จ: { "data": {...}, "meta": {...} } (meta ไม่บังคับ)
  • • ข้อผิดพลาด: { "error": { "code": "...", "message": "..." } }

การจัดการบัญชี

สอบถามยอดเงินในกระเป๋าและข้อมูลผู้ใช้

GET /v1/wallet/balance

สอบถามยอดเงิน

สอบถามยอดเงินในกระเป๋าปัจจุบัน

ตัวอย่างการตอบกลับ:

{
  "data": {
    "balanceSun": 1000000,
    "frozenSun": 0,
    "totalSun": 1000000
  }
}
GET /v1/users/me

ข้อมูลผู้ใช้

สอบถามข้อมูลพื้นฐานของผู้ใช้ปัจจุบัน

ตัวอย่างการตอบกลับ:

{
  "data": {
    "id": 123456,
    "email": "user@example.com",
    "emailVerified": true,
    "createdAt": "2025-01-01T00:00:00Z"
  }
}

การจัดการคำสั่งซื้อ

สร้างและสอบถามคำสั่งซื้อพลังงาน

POST /v1/energy/orders

สร้างคำสั่งซื้อ

สร้างคำสั่งซื้อเช่าพลังงานสำหรับที่อยู่ที่ระบุ (ปัจจุบันรองรับเฉพาะประเภท manual)

พารามิเตอร์คำขอ:

พารามิเตอร์ ประเภท จำเป็น คำอธิบาย
type string ใช่ ประเภทคำสั่งซื้อ ปัจจุบันรองรับเฉพาะ "manual"
data.tronAddress string ใช่ ที่อยู่ TRON ที่จะรับพลังงาน (34 ตัวอักษร เริ่มต้นด้วย T)
data.energyValue int64 ใช่ จำนวนพลังงาน (ตัวเลข ขั้นต่ำ 32000 แนะนำ 65000 สำหรับการโอน USDT)
data.durationHours int ใช่ ระยะเวลาเช่า (ชั่วโมง ค่าที่ถูกต้อง: 1, 24, 72, 168, 336, 720)

ตัวอย่างคำขอ:

{
  "type": "manual",
  "data": {
    "tronAddress": "TYour1Address2Here3...",
    "energyValue": 65000,
    "durationHours": 1
  }
}

ตัวอย่างการตอบกลับ:

{
  "data": {
    "id": 1234567890,
    "userId": 9876543210,
    "tronAddress": "TYour1Address2Here3...",
    "energyValue": 65000,
    "durationHours": 1,
    "priceSun": 3000000,
    "priceTrx": 3.0,
    "orderType": "manual",
    "status": "processing",
    "createdAt": "2025-01-15T10:30:00Z",
    "updatedAt": "2025-01-15T10:30:00Z",
    "statusUpdatedAt": "2025-01-15T10:30:00Z",
    "canTransitionTo": ["completed", "failed"]
  }
}
GET /v1/energy/orders/:id

สอบถามคำสั่งซื้อ

สอบถามรายละเอียดคำสั่งซื้อตาม ID

ตัวอย่างการตอบกลับ:

{
  "data": {
    "id": 1234567890,
    "userId": 9876543210,
    "tronAddress": "TYour1Address2Here3...",
    "energyValue": 65000,
    "durationHours": 1,
    "priceSun": 3000000,
    "priceTrx": 3.0,
    "orderType": "manual",
    "status": "completed",
    "txid": "abc123...",
    "createdAt": "2025-01-15T10:30:00Z",
    "completedAt": "2025-01-15T10:30:05Z",
    "updatedAt": "2025-01-15T10:30:05Z",
    "statusUpdatedAt": "2025-01-15T10:30:05Z",
    "canTransitionTo": []
  }
}
GET /v1/energy/orders

รายการคำสั่งซื้อ

สอบถามรายการคำสั่งซื้อ (รองรับการแบ่งหน้าและตัวกรอง)

พารามิเตอร์คำขอ:

พารามิเตอร์ ประเภท จำเป็น คำอธิบาย
offset number ไม่ จุดเริ่มต้น ค่าเริ่มต้น 0
limit number ไม่ จำนวนรายการต่อหน้า ค่าเริ่มต้น 20 สูงสุด 100
status string ไม่ กรองตามสถานะคำสั่งซื้อ: processing, completed, failed

ตัวอย่างการตอบกลับ:

{
  "data": {
    "orders": [
      {
        "id": 1234567890,
        "userId": 9876543210,
        "tronAddress": "TYour1...",
        "energyValue": 65000,
        "durationHours": 1,
        "priceSun": 3000000,
        "priceTrx": 3.0,
        "orderType": "manual",
        "status": "completed",
        "createdAt": "2025-01-15T10:30:00Z",
        "updatedAt": "2025-01-15T10:30:05Z",
        "statusUpdatedAt": "2025-01-15T10:30:05Z",
        "canTransitionTo": []
      }
    ],
    "total": 100,
    "offset": 0,
    "limit": 20
  }
}

การจัดการที่อยู่

จัดการที่อยู่ผู้รับที่ใช้บ่อย

POST /v1/addresses

เพิ่มที่อยู่

บันทึกที่อยู่ใหม่

ตัวอย่างคำขอ:

{
  "tronAddress": "TYour1Address2Here3...",
  "label": "กระเป๋าหลัก",
  "isDefault": false
}

ตัวอย่างการตอบกลับ:

{
  "data": {
    "id": 1,
    "tronAddress": "TYour1Address2Here3...",
    "label": "กระเป๋าหลัก",
    "isDefault": false,
    "usageCount": 0,
    "createdAt": "2025-01-01T00:00:00Z"
  }
}
GET /v1/addresses

รายการที่อยู่

รับรายการที่อยู่ที่บันทึกไว้

ตัวอย่างการตอบกลับ:

{
  "data": {
    "addresses": [
      {
        "id": 1,
        "tronAddress": "TYour1Address2Here3...",
        "label": "กระเป๋าหลัก",
        "isDefault": true,
        "usageCount": 5,
        "lastUsedAt": "2025-01-15T10:30:00Z",
        "createdAt": "2025-01-01T00:00:00Z"
      }
    ],
    "total": 1
  }
}
GET /v1/addresses/:id

รายละเอียดที่อยู่

สอบถามข้อมูลของที่อยู่

ตัวอย่างการตอบกลับ:

{
  "data": {
    "id": 1,
    "tronAddress": "TYour1Address2Here3...",
    "label": "กระเป๋าหลัก",
    "isDefault": true,
    "usageCount": 5,
    "lastUsedAt": "2025-01-15T10:30:00Z",
    "createdAt": "2025-01-01T00:00:00Z"
  }
}
PUT /v1/addresses/:id/label

อัปเดตป้ายกำกับที่อยู่

เปลี่ยนป้ายกำกับของที่อยู่

ตัวอย่างคำขอ:

{
  "label": "ป้ายกำกับใหม่"
}

ตัวอย่างการตอบกลับ:

{
  "data": {
    "id": 1,
    "tronAddress": "TYour1Address2Here3...",
    "label": "ป้ายกำกับใหม่",
    "isDefault": false,
    "usageCount": 3,
    "lastUsedAt": "2025-01-15T10:30:00Z",
    "createdAt": "2025-01-01T00:00:00Z"
  }
}
PUT /v1/addresses/:id/default

ตั้งเป็นที่อยู่เริ่มต้น

ตั้งที่อยู่ที่ระบุเป็นที่อยู่ผู้รับเริ่มต้น

ตัวอย่างการตอบกลับ:

// HTTP 204 No Content
// ไม่มีเนื้อหาการตอบกลับ

ส่งคืนสถานะ 204 โดยไม่มีเนื้อหาเมื่อสำเร็จ
DELETE /v1/addresses/:id

ลบที่อยู่

ลบที่อยู่ที่บันทึกไว้