Links

Responses

Strictly speaking, this endpoint’s responses fully conform to the HTTP standard, returning status codes related to the request to run a model. Practically speaking, for an HTTP 201 response, you also need to check the model response body for any errors generated by the model itself.
This also means that 4xx and 5xx responses are returned strictly from the API gateway’s perspective, not the models’.
Response
Reason
201 ⚠️
The API call succeeded. The success/failure of the model run can only be determined by checking the response body. See below for more information.
400
Invalid request, for example invalid or missing required request parameters.
401
Authentication key is required for the endpoint.
403
Invalid or expired authentication key.
404
Resource not found.
429
Request denied because it exceeded the rate limit.
50X
Server-level error.

A Successful Model Run

This is the response from the example input above:
{
"slug":"price.dex-blended",
"version":"1.13",
"chainId":1,
"blockNumber":15502869,
"output":{
"price":92.80334705561403,
"src":"uniswap-v2,sushiswap,uniswap-v3"
},
"dependencies":{
"dex.primary-tokens":{"0.1":60},
"contract.metadata":{"1.0":13},
"uniswap-v2.get-pools":{"1.7":5},
"uniswap-v2.get-pool-price-info":{"1.11":23},
"uniswap-v2.get-pool-info-token-price":{"1.12":5},
"uniswap-v2.get-weighted-price":{"1.4":7},
"sushiswap.get-v2-factory":{"1.0":5},
"sushiswap.get-pools":{"1.5":5},
"sushiswap.get-pool-info-token-price":{"1.10":5},
"sushiswap.get-weighted-price":{"1.5":4},
"uniswap-v3.get-pools":{"1.5":5},
"uniswap-v3.get-pool-info":{"1.10":28},
"uniswap-v3.get-pool-price-info":{"1.3":39},
"uniswap-v3.get-pool-info-token-price":{"1.15":5},
"uniswap-v3.get-weighted-price":{"1.4":17},
"price.dex-pool":{"0.4":1},
"price.dex-blended":{"1.13":1}
},
"runtime":58141
}
Lots of interesting things in this output.
Field
Value
Meaning
slug
price.dex-blended
The slug (unique ID) of the model that was run.
version
1.13
The model’s version number
chainId
1
The chain from which the data was retrieved. In this case, 1, i.e., Ethereum Mainnet.
blockNumber
15502869
The block for which the response is valid. In the input we specified “latest”, which maps to this number.
output
{...}
The data returned by the price.dex-blended model. See below for details.
dependencies
{...}
The slugs of the models on which this model depends, their version, and the number of times they were run.
runtime
58141
The amount of time, in milliseconds, it took to execute the model.
The output block is the meat of our response. The fact that we have an output block and not an error block means that the model ran successfully. This data is returned by the model itself. It may change as the model is updated.
In this case we have:
Field
Value
Meaning
price
92.80334705561403
This is the price of the AAVE token, in USD, at the requested block number. The price is computed from data retrieved from the sources listed in the src field.
src
uniswap-v2, sushiswap,
uniswap-v3
The three DEXes where we found liquidity for the AAVE token.

A Failed Model Run

Now, let’s run the same model but provide an invalid token address: "0xNoNoNo".
Our output is completely different:
{
"slug":"price.dex-blended",
"version":"1.13",
"chainId":1,
"blockNumber":15502985,
"error":{
"type":"ModelInputError",
"message":"Error validating model price.dex-blended input: Address validation error: invalid literal for int() with base 16: '0xNoNoNo'",
"stack":[{
"slug":"price.dex-blended",
"version":"1.13",
"chainId":1,
"blockNumber":15502985,
"trace":""}],
"code":"generic",
"detail":null,
"permanent":false
},
"dependencies":{
"price.dex-blended":{"1.13":1}
},
"runtime":128
}
Instead of an output block we have an error block with details of the error. type and message are self-explanatory. The others are useful to model developers.
Note that if we run cURL with a --include switch we see that the response code is 201.