Z Zise Developers 简体中文

Positions and cumulative returns

GET /v1/earn/positions scope: earn:read
On behalf of a member · x-on-behalf-of required

⚠ The renewal enum is principal_interest, not both. The subscription implementation silently falls back to the product default for unknown values, executing another option without an error. The Open API instead rejects this immediately; see POST /v1/earn/subscriptions. The member client still falls back, so the two paths differ.

The envelope has two sections for different reasons:

  • data: fixed-term orders, with real cursor pagination, one row per order and potentially many rows.
  • flexible: flexible balance pools, one row per product, unpaginated because row count scales with products.

⚠ Both sections use ern_ prefixes for id, but they identify three different things: data[].id is a fixed-term order ID; data[].product_id and flexible[].product_id are product IDs; flexible[].id is a flexible position ID. The same fixed-term order uses ero_ in GET /v1/earn/orders. Prefixes differ between endpoints; interpret them per endpoint rather than comparing strings across endpoints.

⚠ principal is an integer string in minor units, using the asset’s ledger_scale. Scale is not returned here; obtain it from the product list.

⚠ This endpoint does not return cumulative interest. Fixed-term settled interest is in settled_interest from GET /v1/earn/orders; flexible interest has already been paid into available balance and appears in statements.

Query Parameters

FieldTypeRequiredDescription
limit integer Optional Applies only to data, the fixed-term section. Default 20, maximum 100.
cursor string Optional Applies only to data, the fixed-term section.
FieldTypeRequiredDescription
x-on-behalf-of string Required Member whose positions are queried.

Response

200data[].status values: pending_start / starting / accruing / pending_settle / settling / settled / closed. Expose unknown values unchanged, never default to “processing”. This rule caught the misspelling pending_value immediately in our own client.
{
  "data": [
    {
      "id": "ern_c41d7f92-8a03-4bb6-9e10-5f2c8d3a7061",
      "product_id": "ern_7d2b48ae-19c3-4f60-8c55-0ab3e9f21744",
      "asset": "USDT",
      "principal": "10000000000",
      "status": "accruing",
      "maturity_date": "2026-11-10",
      "kind": "fixed"
    }
  ],
  "next_cursor": null,
  "has_more": false,
  "flexible": [
    {
      "id": "ern_9b6e2a11-3c74-4d05-8f39-71ba0c5d4e28",
      "product_id": "ern_3a91f0c2-5d17-4e88-b2a0-91c7d4e6b501",
      "asset": "USDT",
      "principal": "2500000000",
      "kind": "flexible"
    }
  ]
}
400member_context_required · member_not_found
403insufficient_scope
Request
curl -X GET 'https://api.zinfra.vip/v1/earn/positions' \
  -H 'x-auth-token: Bearer $TOKEN' \
  -H 'x-on-behalf-of: $MEMBER_ID'
const res = await fetch("https://api.zinfra.vip/v1/earn/positions", {
  method: "GET",
  headers: {
    "x-auth-token": "Bearer $TOKEN",
    "x-on-behalf-of": "$MEMBER_ID",
  },
});
// Keep monetary amounts as strings, never numbers.
const data = await res.json();
import requests

res = requests.get(
    "https://api.zinfra.vip/v1/earn/positions",
    headers={
        "x-auth-token": "Bearer $TOKEN",
        "x-on-behalf-of": "$MEMBER_ID",
    },
)
# Use Decimal(str(...)) for amounts, not float.
data = res.json()
req, _ := http.NewRequest("GET", "https://api.zinfra.vip/v1/earn/positions",
    nil)
req.Header.Set("x-auth-token", "Bearer $TOKEN")
req.Header.Set("x-on-behalf-of", "$MEMBER_ID")
res, err := http.DefaultClient.Do(req)
// Decode amount fields as string, not float64.
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://api.zinfra.vip/v1/earn/positions"))
    .header("x-auth-token", "Bearer $TOKEN")
    .header("x-on-behalf-of", "$MEMBER_ID")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
// Use String / BigDecimal for amounts, not double.
$ch = curl_init('https://api.zinfra.vip/v1/earn/positions');
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'x-auth-token: Bearer $TOKEN',
    'x-on-behalf-of: $MEMBER_ID',
  ],
]);
$res = curl_exec($ch);
// Use bcmath / strings for amounts, not floatval.
200
{
  "data": [
    {
      "id": "ern_c41d7f92-8a03-4bb6-9e10-5f2c8d3a7061",
      "product_id": "ern_7d2b48ae-19c3-4f60-8c55-0ab3e9f21744",
      "asset": "USDT",
      "principal": "10000000000",
      "status": "accruing",
      "maturity_date": "2026-11-10",
      "kind": "fixed"
    }
  ],
  "next_cursor": null,
  "has_more": false,
  "flexible": [
    {
      "id": "ern_9b6e2a11-3c74-4d05-8f39-71ba0c5d4e28",
      "product_id": "ern_3a91f0c2-5d17-4e88-b2a0-91c7d4e6b501",
      "asset": "USDT",
      "principal": "2500000000",
      "kind": "flexible"
    }
  ]
}