Links

Point in time

Sometimes we want to know more than how many tokens a portfolio holds. Sometimes we want to know their value, or just the value of the portfolio. This is where the value endpoint comes into play.

Simple Request

Here's the simplest request possible.
curl \
-H 'Authorization: Bearer <API KEY>' \
'https://gateway.credmark.com/v1/portfolio/1/0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A/value
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:
Segment
Meaning
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 to be valued.
value
The requested resource, in this case, value.
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 optional parameters: blockNumber and timestamp. Refer to the Time section to understand their use.
It also supports the optional parameter quoteAddress, which defaults to USD, i.e., 0x0000000000000000000000000000000000000348.
Note that we left includePositions' default, i.e., false. Below we'll see what happens if we set it to true.

Simple Response

This is the response:
{
"chainId": 1,
"blockNumber": 17563853,
"blockTimestamp": 1687785611,
"accounts": [
"0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A"
],
"quoteAddress": "0x0000000000000000000000000000000000000348",
"value": 679.1051361724352
}
Our response body includes the context of the request:
Field
Value
Meaning
chainID
1
The Chain ID, in this case, Ethereum mainnet
blockNumber
17563853
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
1687785611
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.
quoteAddress
0x0000000000000000000000000000000000000348
This is the address of the token in which value is computed. In this case, the token used is the default, i.e., the special token which represents the USD.
value
679.1051361724352
The value of the portfolio, i.e, USD 679.11.

A More Granular Request

For this example we will repeat the simple request above but change includePositions to true.
curl
-H 'Authorization: Bearer '
'https://gateway.credmark.com/v1/portfolio/1/0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A/value?includePositions=true

A More Granular Response

Since we have included positions, our response now includes the value of each individual position as well.
{
"chainId": 1,
"blockNumber": 17564213,
"blockTimestamp": 1687789943,
"accounts": [
"0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A"
],
"quoteAddress": "0x0000000000000000000000000000000000000348",
"value": 683.1329274926395,
"positions": [
{
"tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"balance": 0.2747114942399529,
"tokenPrice": 1894.37,
"value": 520.4052133433395
},
{
"tokenAddress": "0x43f11c02439e2736800433b4594994bd43cd066d",
"balance": 1370583.044686943,
"tokenPrice": 7.899819514313488e-8,
"value": 0.10827358682405108
},
{
"tokenAddress": "0x68cfb82eacb9f198d508b514d898a403c449533e",
"balance": 6992.117661177189,
"tokenPrice": 0.002415927069032182,
"value": 16.89244632749596
},
{
"tokenAddress": "0x8588d3a5fa9f63fa150815a88fc97183104fb6dc",
"balance": 250,
"tokenPrice": 0.0029783882746327395,
"value": 0.7445970686581849
},
{
"tokenAddress": "0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab",
"balance": 57.912372252507524,
"tokenPrice": 1.3297008977999742,
"value": 77.00613337788558
},
{
"tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"balance": 31.62,
"tokenPrice": 0.99980957,
"value": 31.613978603400003
},
{
"tokenAddress": "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e",
"balance": 1370583.044686943,
"tokenPrice": 0.00002653052314195368,
"value": 36.36228518503628
},
{
"tokenAddress": "0xf61cacbd97a5f41e9bec170f21a8ff0b276b0266",
"balance": 21129.148888,
"tokenPrice": 0,
"value": 0
}
]
}