Skip to Content
Assetera Docs
API reference

Portfolio API

Read a customer's holdings across all approved wallets and chains with GET /me/holdings: the request, the fields, partial failure, and filtering to your offer.

GET /me/holdings returns the signed-in customer's holdings across every approved wallet and every chain, with a price per position and a total in one quote currency. Your server calls it with the customer's bearer token. The response is always the complete Assetera portfolio of the customer, also assets bought outside your storefront. A per-position flag tells you which assets your tenant offers, so you decide what to show.

At a glance
Method and pathGET /me/holdings
CallerYour server or BFF, with the customer's access token
Parametersquote only (optional, default EUR)
ScopeThe caller's own approved wallets, all chains, all assets
Partial failureStill 200. The degraded array names what could not be read.

Request

GET /me/holdings?quote=EUR HTTP/1.1
Host: api.<base_domain>
Authorization: Bearer <customer_access_token>
Accept: application/json
ParameterRequiredMeaning
quotenoThe currency for every price and total. An ISO code (EUR, USD) or an on-chain settlement symbol (USDC). Case does not matter. Default EUR. An unknown code gives price: null, not an error.

There is no wallet, address, or customer parameter. The API finds the customer's approved wallets from the signed token. A client cannot ask for the wallets of a different customer.

Send the token of the customer. A service-account token (Client Credentials grant) has no portfolio and receives an empty 200. See Authentication for the grants.

Example response

Trimmed to two positions. The first asset is offered in your tenant, the second was bought elsewhere on Assetera.

{
  "asOf": "2026-11-10T09:30:02.114Z",
  "positions": [
    {
      "chainId": "eip155:137",
      "tokenAddress": "0x1111111111111111111111111111111111111111",
      "holder": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "symbol": "EXA",
      "name": "Example Fund A",
      "decimals": 18,
      "raw": "2500000000000000000",
      "kind": "asset",
      "logicalGroup": null,
      "tradeable": true,
      "offeredInTenant": true,
      "asOf": "2026-11-10T09:29:41.000Z",
      "asOfBlock": 64123456,
      "unavailable": false,
      "price": {
        "value": "102.40",
        "currencyCode": "EUR",
        "valuation": "feed-mid",
        "priceSource": "feed_mid",
        "asOf": "2026-11-10T09:30:02.114Z",
        "priceAsOf": "2026-11-10T09:25:00.000Z",
        "fx": null,
        "pairId": 42
      },
      "value": "256.00"
    },
    {
      "chainId": "eip155:137",
      "tokenAddress": "0x2222222222222222222222222222222222222222",
      "holder": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "symbol": "EXB",
      "name": "Example Bond B",
      "decimals": 18,
      "raw": "10000000000000000000",
      "kind": "asset",
      "logicalGroup": null,
      "tradeable": true,
      "offeredInTenant": false,
      "asOf": "2026-11-10T09:29:41.000Z",
      "asOfBlock": 64123456,
      "unavailable": false,
      "price": {
        "value": "12.50",
        "currencyCode": "EUR",
        "valuation": "last-trade",
        "priceSource": "last_fill",
        "asOf": "2026-11-10T09:30:02.114Z",
        "priceAsOf": "2026-11-07T14:12:09.000Z",
        "fx": null,
        "pairId": 57
      },
      "value": "125.00"
    }
  ],
  "degraded": [],
  "totals": {
    "quoteCode": "EUR",
    "value": "381.00",
    "unpricedPositions": 0,
    "unavailableQuantities": 0,
    "degradedChains": 0,
    "oldestPriceAsOf": "2026-11-07T14:12:09.000Z",
    "offeredInTenant": {
      "value": "256.00",
      "unpricedPositions": 0,
      "unavailableQuantities": 0,
      "oldestPriceAsOf": "2026-11-10T09:25:00.000Z"
    }
  }
}

2.5 EXA at 102.40 gives 256.00, and 10 EXB at 12.50 gives 125.00. The two value fields add up to totals.value (381.00). Only EXA is offered in the tenant, so totals.offeredInTenant.value is 256.00.

Response fields

Envelope

FieldTypeMeaning
asOfstring (ISO 8601)When the API built this response.
positionsarrayOne entry per token, per wallet, per chain. The same token in two wallets is two positions.
degradedarrayWhat could not be read. Always present, [] on full success. See Partial failure.
totalsobjectThe headline value and the counts it does not include.

Position

FieldTypeMeaning
chainIdstringCAIP-2 chain id, for example eip155:137.
tokenAddressstringThe token contract. native for the gas coin of the chain. Branch on kind, not on this value.
holderstringThe customer's wallet that holds the position.
symbol, namestring, string or nullDisplay labels.
decimalsintegerBase-unit decimals of the token.
rawstringThe quantity in base units, as a decimal string of digits. Never a number.
kindasset | settlement | nativeAn instrument, a settlement currency (for example USDC), or the gas coin of the chain.
logicalGroupstring or nullThe logical instrument the token belongs to, when the catalog has one.
tradeablebooleanThe instrument is still active on the Assetera platform. false is not an error: the customer still owns it. Always false for a gas coin.
offeredInTenantbooleanYour tenant offers this asset. See All assets or only the assets you offer.
asOfstringWhen this quantity was read from the chain. Can be older than the envelope asOf.
asOfBlockinteger or nullThe block of that read.
unavailablebooleantrue: this quantity is not trustworthy. Show it as unknown, never as zero.
priceobject or nullThe price of one whole token in the quote currency. null when there is no price. Never a zero.
valuestring or nullThe value of this position in totals.quoteCode: quantity times price.value, rounded once, half up, to 2 decimal places. Decimal string. null when price is null or unavailable is true. Never a zero for an unknown value.

Price

FieldMeaning
valuePrice of one whole token, as a decimal string.
currencyCodeThe quote currency.
priceSourceWhere the price comes from: feed_mid, last_fill, reference, primary_sale, or settlement_currency.
valuationThe same source, older names: feed-mid, last-trade, reference-price, primary-sale-price, settlement-currency. Both always agree.
priceAsOfWhen the price was observed. Use this for an "as of" label. null for an operator-set price, which has no time of its own.
asOfWhen the API resolved the price, which is always the request time. Do not use it as an "as of" label.
fxThe exchange rate applied (rate, baseCode, asOf), or null if no conversion was necessary.
pairIdThe market the price comes from, when there is one.

Totals

FieldMeaning
quoteCodeThe quote currency of every value in totals.
valueSum of positions[].value over the positions where it is not null. Decimal string. The rows always add up to this total.
unpricedPositionsPositions with a quantity but no price. Not in value.
unavailableQuantitiesPositions with unavailable: true. Not in value.
degradedChainsChains in degraded. Their holdings can be missing from value and from the counts.
oldestPriceAsOfThe oldest priceAsOf inside value. A total is only as current as its oldest price. null when no price in it has a time.
offeredInTenantThe same value, unpricedPositions, unavailableQuantities and oldestPriceAsOf, calculated only over positions with offeredInTenant: true.

value, unpricedPositions and unavailableQuantities split the position list with no overlap. Show the counts beside the value, for example "EUR 381.00, 2 holdings without a price".

All assets or only the assets you offer

The response always contains the complete portfolio. Your storefront decides which view to show.

ViewPositionsHeadline total
All assetsevery entry in positionstotals.value
Only the assets you offerentries with offeredInTenant: truetotals.offeredInTenant.value

offeredInTenant is true when:

kindofferedInTenant is true when
assetAt least one market of the instrument is offered to and visible in your tenant.
settlementThe currency is the quote currency of at least one such market.
nativeAlways.

offeredInTenant and tradeable are different facts. An asset can be active on the platform (tradeable: true) and still not be offered in your tenant.

app/api/portfolio/route.ts (server)
import { formatUnits } from "viem";
import { getSession } from "@/lib/session";

export async function GET(req: Request) {
  const session = await getSession();
  // Refresh the access token here when it is about to expire. Customer tokens are short-lived.
  if (!session.accessToken) return new Response("unauthenticated", { status: 401 });

  const onlyOffered = new URL(req.url).searchParams.get("view") === "offered";
  const res = await fetch(`${process.env.ASSETERA_API_BASE_URL}/me/holdings?quote=EUR`, {
    headers: { authorization: `Bearer ${session.accessToken}`, accept: "application/json" },
    cache: "no-store",
  });
  if (!res.ok) return new Response(null, { status: res.status }); // 503: retry, never "empty"

  const body = await res.json();
  const positions = onlyOffered
    ? body.positions.filter((p) => p.offeredInTenant === true)
    : body.positions;

  return Response.json({
    positions: positions.map((p) => ({
      ...p,
      quantity: p.unavailable ? null : formatUnits(BigInt(p.raw), p.decimals), // a decimal string
      value: p.value, // from the API as is: a decimal string, or null when unknown
    })),
    total: onlyOffered ? body.totals.offeredInTenant : body.totals,
    quoteCode: body.totals.quoteCode,
    degraded: body.degraded,
  });
}

Rules for both views:

  • Show value on each row and take the total from totals. Do not multiply quantity by price, and never add values in the browser. The API rounds each position once and sums the rounded values, so its total matches its rows.
  • Keep quantities and prices as decimal strings. Convert raw with decimals using string or BigInt arithmetic. A JavaScript number loses precision at 18 decimals.
  • Show a position with value: null without a value, not as zero. This is the case when price is null or unavailable is true. A gas coin never has a price today.

Partial failure

A chain that cannot be read gives a degraded entry and a 200. It never gives a missing position that looks like zero, and an error never produces an empty positions array.

SignalWhat it meansWhat to show
degraded entry for a chainId and holderThe API could not refresh that wallet on that chain. Its positions are the last known values, each with its own older asOf. If there are none, the wallet has no positions on that chain in the response.The positions with "as of" their asOf, never as current, plus a notice that part of the portfolio could not refresh.
degraded entry with chainId: "*" and holder: "*"The list of approved wallets could not be read. The API used the last known list.A notice for the whole portfolio.
unavailable: trueThis one quantity is not trustworthy."Unknown", never zero. It is counted in unavailableQuantities.
price: nullNo price in the quote currency.The quantity without a value. It is counted in unpricedPositions.
reasonMeaning
rpc_unreachableThe chain did not answer, or answered for only part of the tokens.
chain_unconfiguredThe API cannot read this chain at the moment.
multicall_unavailableThe batch read on this chain failed.
wallet_registry_unavailableThe wallet list could not be read (always with "*").
timeoutThe request ran out of time before this wallet and chain were read.
unknownAny other read failure.

Quantities are cached and read again from the chain when the cache is too old. Prices are never cached. They are resolved on each request.

Status codes

StatusMeaningWhat to do
200The portfolio. Also when part of it could not be read: check degraded.Render it, with the markers above.
400quote is not in the form of a currency code (2 to 12 letters and digits, starting with a letter). The API does not fall back to EUR. A well-formed code that no rate reaches is not a 400: the response is a 200 with price: null on the positions it cannot value.Fix the request. Do not retry unchanged.
401Token is missing, expired, or invalid.Refresh the token on your server, then retry.
503The API could not find the customer's wallets at all. Body: { "error": "..." }.Retry with backoff. Never render it as an empty portfolio.

Your data responsibility

Your server receives the complete Assetera portfolio of the customer, including assets that you do not offer. You are responsible for what you store, what you log, and what you show. Store only what your storefront needs. See Tenancy and responsibility for the split of duties.

On this page