Point in time

In order to retrieve positions at a point in time, we call the positions endpoint.

Request

To retrieve the positions associated with a single wallet at the most recent block, we make a request similar to the following:

curl \
-H 'Authorization: Bearer <API KEY>' \
'https://gateway.credmark.com/v1/portfolio/1/0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A/positions'

We only need to pass one value in the request header, our API Key.

The request URL construction is straightforward. These are the path segments, in order, and their meaning:

SegmentMeaning

v1

The API version

portfolio

The API name

1

The Chain ID, in this case, Ethereum mainnet

0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A

The address of the wallet from which we want to extract positions

positions

The requested resource, in this case, positions

Instead of one wallet, we could have passed a comma-separated list.

By default this endpoint returns a list of all tokens with a non-zero balance, but the optional tokens parameter allows you to pass in a comma separated list of token addresses whose positions you want. In that case, all other tokens will be excluded from the result set.

This endpoint supports two other optional parameters: blockNumber and timestamp. Refer to the Time section to understand their use.

Response

The request above yields a response like this one:

{
  "chainId": 1,
  "blockNumber": 17550049,
  "blockTimestamp": 1687617815,
  "accounts": [
    "0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A"
  ],
  "positions": [
    {
      "tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "balance": 0.2747114942399529
    },
    {
      "tokenAddress": "0x43f11c02439e2736800433b4594994bd43cd066d",
      "balance": 1370583.044686943
    },
    {
      "tokenAddress": "0x68cfb82eacb9f198d508b514d898a403c449533e",
      "balance": 6992.117661177189
    },
    {
      "tokenAddress": "0x8588d3a5fa9f63fa150815a88fc97183104fb6dc",
      "balance": 250
    },
    {
      "tokenAddress": "0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab",
      "balance": 57.912372252507524
    },
    {
      "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "balance": 31.62
    },
    {
      "tokenAddress": "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e",
      "balance": 1370583.044686943
    },
    {
      "tokenAddress": "0xf61cacbd97a5f41e9bec170f21a8ff0b276b0266",
      "balance": 21129.148888
    }
  ]
}

Our response body includes the context of the request:

FieldValueMeaning

chainID

1

The Chain ID, in this case, Ethereum mainnet

blockNumber

17550049

This is the block number for which the request was made. Note that if no block number is provided, the latest available is used.

blockTimestamp

1687617815

This is the timestamp (number of seconds since January 1st, 1970) associated with the block above.

accounts

[ "0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A" ]

The list of accounts (wallets) from which positions were extracted.

The response then contains an array of positions, i.e., token addresses and the amount of that token held by the list of wallets provided. Note that additional information about the tokens can be retrieved using the Token API.

Last updated