Skip to content

External API Integration Documentation

I. API Overview

This document is intended for external developers who need to integrate device data queries.

API Features

  • SK Authentication: Header carries X-Saas-Id + X-SK, does not use platform JWT Token
  • IP Whitelist: IP whitelist can be configured for users in the backend (multiple specific IPs, comma-separated); if empty, no restriction
  • Rate Limiting: Executed according to platform-configured rate limit rules (supports account-specific or global defaults)
  • Query Interfaces: Device status, configuration, earnings, etc. are all GET
  • Write Interfaces: Device bind/unbind are POST (requires SK authentication, no transaction password needed)

II. Basic Information

Service URL

Production Environment: https://api.morphogenai.top

There is currently no separate test environment available.

The external business API path prefix is /api, full example:

https://api.morphogenai.top/api/device/status

Online documentation (Markdown, UTF-8):

GET https://api.morphogenai.top/api/docs/integration
Content-Type: text/markdown;charset=UTF-8

Character Encoding

ScenarioContent-Type
Business API JSON responseapplication/json;charset=UTF-8
Online docs /api/docs/integrationtext/markdown;charset=UTF-8

Common Request Headers

ParameterTypeRequiredDescription
X-Saas-IdStringYesAccount identifier issued when the platform is activated (provided together with SK, no need to look it up yourself)
X-SKStringYesPlaintext SK issued when the platform is activated (provided together with X-Saas-Id)

Unified Response Format

The business API response body is JSON with the following fields:

FieldTypeDescription
codeStringE_000 success; E_001 failure (see Section IV)
msgString"Success" on success; specific reason on failure
dataObject / nullBusiness data; generally null on failure

Success Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": { }
}

Failure Example:

json
{
    "code": "E_001",
    "msg": "Authentication failed: SK verification failed",
    "data": null
}

Time Field Format: String, e.g., 2026-05-31T09:30:25 (LocalDateTime JSON serialization, no timezone suffix).

Missing Parameters: When required Query parameters are missing, the framework returns HTTP 400 and does not enter the business ResultVo.

Default Rate Limit Configuration

The platform default rate limits are as follows (administrators can adjust for individual accounts):

Interfaceapi_codetime_windowmax_requestsDescription
Device Online StatusDEVICE_STATUS1_MINUTE11 time per minute
Token SettlementTOKEN_SETTLE1_HOUR11 time per hour
Device ConfigDEVICE_CONFIG1_DAY11 time per day
Config OccupancyDEVICE_CONFIG_OCCUPY1_HOUR11 time per hour
Device LocationDEVICE_LOCATION5_MINUTE11 time per 5 minutes
Single Device EarningsDEVICE_EARNINGS1_DAY11 time per day
Account Device Earnings SummaryACCOUNT_DEVICE_EARNINGS1_DAY11 time per day
Bind DeviceDEVICE_BIND1_MINUTE55 times per minute
Unbind DeviceDEVICE_UNBIND1_MINUTE55 times per minute

Earnings Notes:

TypeSingle Device Earnings APIAccount Earnings Summary API
Static Release EarningsYes (staticRelease)Yes (staticRelease)
Dynamic EarningsNo (dynamic is always 0)Yes (dynamic)

Earnings are in USD.


III. API List

1. Device Online Status

ItemDescription
EndpointGET /api/device/status
api_codeDEVICE_STATUS
Default Rate1 time per minute

Request Parameters

Header

ParameterTypeRequiredDescription
X-Saas-IdStringYesX-Saas-Id issued when the platform is activated
X-SKStringYesCaller's SK

Query

ParameterTypeRequiredDescription
deviceIdStringYesDevice serial number (sn_code)

Response data Fields

FieldTypeDescription
deviceIdStringSame as input
onlineStatusInteger1 online, 0 offline
lastHeartbeatString / nullLatest sync or online/offline time; may be null
networkTypeStringISP; UNKNOWN if no data

Only queries devices bound to the current X-Saas-Id.

Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": {
        "deviceId": "CL20260327103546870813300",
        "onlineStatus": 1,
        "lastHeartbeat": "2026-06-08T10:30:25",
        "networkType": "Verizon"
    }
}

2. Token Settlement Data

ItemDescription
EndpointGET /api/token/settlement
api_codeTOKEN_SETTLE
Default Rate1 time per hour

Request Parameters

Header

ParameterTypeRequiredDescription
X-Saas-IdStringYesX-Saas-Id issued when the platform is activated
X-SKStringYesCaller's SK

Query: None

Response data Fields

FieldTypeDescription
saasIdStringSame as X-Saas-Id
totalTokensIntegerTotal released Tokens
settledTokensIntegerTotal daily-settled Tokens
unsettledTokensIntegerUnsettled Tokens (totalTokens - settledTokens, minimum 0)
lastSettlementTimeString / nullLatest settlement time; null if no record

Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": {
        "saasId": "test_saas_001",
        "totalTokens": 10000,
        "settledTokens": 8500,
        "unsettledTokens": 1500,
        "lastSettlementTime": "2026-05-31T08:00:00"
    }
}

3. Device Configuration Query

ItemDescription
EndpointGET /api/device/config
api_codeDEVICE_CONFIG
Default Rate1 time per day

Request Parameters

Header: X-Saas-Id, X-SK (required, same as Section I)

Query

ParameterTypeRequiredDescription
deviceIdStringYesDevice serial number (sn_code)

Response data Fields

FieldTypeDescription
deviceIdStringSame as input
modelStringCPU model or upstream name; UNKNOWN if no data
versionStringOS or architecture; UNKNOWN if no data
memoryGbIntegerTotal memory (GB, rounded)
storageGbIntegerTotal disk (GB, rounded)

Only queries devices bound to the current X-Saas-Id.

Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": {
        "deviceId": "CL20260327103546870813300",
        "model": "Intel(R) Core(TM) i7-12700",
        "version": "Linux",
        "memoryGb": 32,
        "storageGb": 1024
    }
}

4. Device Configuration Occupancy Query

ItemDescription
EndpointGET /api/device/config/occupy
api_codeDEVICE_CONFIG_OCCUPY
Default Rate1 time per hour

Request Parameters

Header: X-Saas-Id, X-SK (required)

Query

ParameterTypeRequiredDescription
deviceIdStringYesDevice serial number (sn_code)

Response data Fields

FieldTypeDescription
deviceIdStringSame as input
isBoundBooleanWhether already bound to an account
boundSaasIdString / nullX-Saas-Id of the binding account; null if not bound
boundTimeString / nullBinding time; null if not bound
expireTimenullAlways null (no expiry field currently)

Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": {
        "deviceId": "CL20260327103546870813300",
        "isBound": true,
        "boundSaasId": "2a2cc29053144a6fb84c41039d9717ed",
        "boundTime": "2026-05-01T10:00:00",
        "expireTime": null
    }
}

5. Device Online Location

ItemDescription
EndpointGET /api/device/location
api_codeDEVICE_LOCATION
Default Rate1 time per 5 minutes

Request Parameters

Header: X-Saas-Id, X-SK (required)

Query

ParameterTypeRequiredDescription
deviceIdStringYesDevice serial number (sn_code)

Response data Fields

FieldTypeDescription
deviceIdStringSame as input
longitudenullLatitude/longitude not currently provided, always null
latitudenullLatitude/longitude not currently provided, always null
addressStringRegion description (region); UNKNOWN if no data
updateTimeStringLatest device info sync time

Only queries devices bound to the current X-Saas-Id.

Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": {
        "deviceId": "CL20260327103546870813300",
        "longitude": null,
        "latitude": null,
        "address": "California, USA",
        "updateTime": "2026-06-08T10:30:25"
    }
}

6. Single Device Earnings (by Device ID)

ItemDescription
EndpointGET /api/device/earnings
api_codeDEVICE_EARNINGS
Default Rate1 time per day

Queries static release earnings by device serial number; dynamic is always 0 (for dynamic earnings, use the account earnings summary API).

Request Parameters

Header: X-Saas-Id, X-SK (required)

Query

ParameterTypeRequiredDescription
deviceIdStringYesDevice serial number (sn_code)

Response data Fields

FieldTypeDescription
deviceIdStringSame as input
currencyStringAlways USD
staticReleaseObjectStatic release earnings (see table below)
dynamicObjectDynamic earnings (always 0 for single device, same field structure as staticRelease)
updateTimeStringStatistics update time

staticRelease / dynamic Sub-fields:

FieldTypeDescription
totalNumberCumulative total
todayNumberToday
yesterdayNumberYesterday
  • staticRelease.total: Total daily-settled static release for this device (USD)
  • staticRelease.today: Released today (USD, includes unsettled portion)
  • staticRelease.yesterday: Yesterday's daily-settled static release (USD)
  • dynamic: All zeros for the single device API

Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": {
        "deviceId": "CL20260327103546870813300",
        "currency": "USD",
        "staticRelease": {
            "total": 12.34500,
            "today": 0.51200,
            "yesterday": 0.49800
        },
        "dynamic": {
            "total": 0,
            "today": 0,
            "yesterday": 0
        },
        "updateTime": "2026-06-08T10:30:00"
    }
}

7. Account Device Earnings Summary

ItemDescription
EndpointGET /api/account/device/earnings
api_codeACCOUNT_DEVICE_EARNINGS
Default Rate1 time per day

Queries the total static release and dynamic earnings of all bound devices under the current X-Saas-Id account.

Request Parameters

Header: X-Saas-Id, X-SK (required)

Query: None

Response data Fields

FieldTypeDescription
saasIdStringSame as X-Saas-Id
deviceCountIntegerNumber of currently bound devices
currencyStringAlways USD
staticReleaseObjectTotal account static release earnings (USD)
dynamicObjectTotal account dynamic team rewards (USD)
totalEarningsNumberstaticRelease.total + dynamic.total
updateTimeStringStatistics update time

Example:

json
{
    "code": "E_000",
    "msg": "Success",
    "data": {
        "saasId": "test_saas_001",
        "deviceCount": 3,
        "currency": "USD",
        "staticRelease": {
            "total": 45.67800,
            "today": 1.53600,
            "yesterday": 1.49400
        },
        "dynamic": {
            "total": 8.12000,
            "today": 0.32000,
            "yesterday": 0.28000
        },
        "totalEarnings": 53.79800,
        "updateTime": "2026-06-08T10:30:00"
    }
}

8. Bind Device

ItemDescription
EndpointPOST /api/device/bind
api_codeDEVICE_BIND
Default Rate5 times per minute
Content-Typeapplication/json;charset=UTF-8

Binds a device serial number (sn_code) to the X-Saas-Id account in the Header. The device must already be in the platform's SN whitelist and not occupied by another account.

Request Parameters

Header: X-Saas-Id, X-SK (required)

Body (JSON):

FieldTypeRequiredDescription
deviceIdStringYesDevice serial number
remarkNameStringNoRemark name

Response data Fields

FieldTypeDescription
deviceIdStringDevice serial number
saasIdStringBinding account
bindTimeStringBinding time
onlineStatusInteger1 online, 0 offline

Example:

bash
curl -X POST "https://api.morphogenai.top/api/device/bind" \
  -H "Content-Type: application/json" \
  -H "X-Saas-Id: <X-Saas-Id provided by customer service>" \
  -H "X-SK: <X-SK provided by customer service>" \
  -d '{"deviceId":"CL20260327103546870813300","remarkName":"ServerRoom-A-01"}'

9. Unbind Device

ItemDescription
EndpointPOST /api/device/unbind
api_codeDEVICE_UNBIND
Default Rate5 times per minute
Content-Typeapplication/json;charset=UTF-8

Unbinds the specified device from the current X-Saas-Id account. The external API uses SK authentication and does not require a transaction password.

Request Parameters

Header: X-Saas-Id, X-SK (required)

Body (JSON):

FieldTypeRequiredDescription
deviceIdStringYesDevice serial number

Response data Fields

FieldTypeDescription
deviceIdStringDevice serial number
saasIdStringUnbinding account
unbindTimeStringUnbinding time

Example:

bash
curl -X POST "https://api.morphogenai.top/api/device/unbind" \
  -H "Content-Type: application/json" \
  -H "X-Saas-Id: <X-Saas-Id provided by customer service>" \
  -H "X-SK: <X-SK provided by customer service>" \
  -d '{"deviceId":"CL20260327103546870813300"}'

Common Failure Reasons:

msgDescription
Invalid device IDSN not in platform whitelist
Device not foundDevice does not exist on OpenAPI side
Device already bound by another userAlready occupied by another account
You have already bound this deviceDuplicate binding
Device not boundNo valid binding for current account when unbinding

IV. Error Code Description

codeTypical msgDescription
E_000SuccessBusiness processing successful
E_001Authentication failed: saasId or SK cannot be emptyMissing Header parameters
E_001Authentication failed: User does not existExternal API not activated
E_001Authentication failed: User has been disabledAccount status ≠ 1
E_001Authentication failed: SK verification failedSK mismatch
E_001Request IP is not in the whitelistIP whitelist verification failed
E_001API call frequency exceeded, please try again laterRate limit triggered

On failure, msg is based on the actual response; authentication failures are uniformly prefixed with Authentication failed: .


V. Call Examples

bash
# Replace X-Saas-Id, X-SK, deviceId with the values provided by customer service and the actual device serial number
curl -G "https://api.morphogenai.top/api/device/status" \
  --data-urlencode "deviceId=CL20260327103546870813300" \
  -H "X-Saas-Id: <X-Saas-Id provided by customer service>" \
  -H "X-SK: <X-SK provided by customer service>"

VI. Activation and Usage Flow

  1. Apply for activation: Contact masf58722@gmail.com, describe the business purpose and the caller's source IP (if IP whitelist is needed). No need to look up X-Saas-Id yourself.
  2. Obtain credentials: After review, customer service will provide X-Saas-Id and X-SK in plaintext once. Save them immediately.
  3. Configure whitelist (optional): Provide multiple specific IPs to customer service (comma-separated, wildcards not supported); leave empty for no restrictions.
  4. Call APIs: Following the example in Section V, use the provided X-Saas-Id and X-SK to access /api/** business endpoints.
  5. Subsequent changes: SK reset, IP whitelist, quota adjustments, etc. — please contact masf58722@gmail.com.

VII. Notes

  1. SK Security: SK is equivalent to a secret key; if leaked, contact masf58722@gmail.com to reset it.
  2. Rate Limiting: Subject to the platform's actual configuration; account-specific rules take precedence over global defaults.
  3. IP Whitelist: When the whitelist is non-empty, only the specific IPs listed can call the APIs (exact match, wildcards not supported).
  4. Encoding: Request URLs, Headers, and JSON responses are all UTF-8.

VIII. Contact Support

For activation requests, SK resets, IP whitelist configuration, quota adjustments, etc., please contact masf58722@gmail.com.


Document Version: v2.0
Last Updated: 2026-06-08