Adjusting Timeouts
The following table shows the response limits for each tier:
Tier | Max Response Size (Megabytes) | Response Timeout (Seconds) |
---|---|---|
Free | 10 | 25 |
Developer | 10 | 360 |
Startup | 10 | 360 |
Enterprise | 10* | 600* |
If the above timeouts are reached, the SQL Analytics API will return the data retrieved up to that point.
* Want more? Let's chat.
Adjusting the default query timeout limit (for Developer, Startup, and Enterprise tiers)
To avoid accidentally sending queries that result in large credit charges, the default timeout for SQL requests is 25 seconds. Paid plans allow for longer query timeouts, depending on the tier.
You can set a maximum timeout for your queries by passing an optional options
parameter to the request body. Inside this parameter, specify timeout
with a positive integer. Your query timeout will be set to the lesser of this specified timeout (if you pass it, otherwise the default is 25 seconds), and the maximum timeout allowed for your account tier.
This is useful for requesting longer timeouts for particularly large queries, or shortening your timeouts for testing queries without consuming too many credits.
For example, in the below example we set the timeout to 2 seconds for a particularly expensive COUNT
query, that attempts to count every NFT across the history of Ethereum.
API Key
Before proceeding, we need to authenticate ourselves with Transpose. To access any Transpose API, you'll need an API key. All API requests should include your API key in an X-API-KEY
header. If you haven't already, you'll need to sign up and create a team (for free!). Once you have a team, you can find a list of your API keys in your team dashboard. When you have your API key, replace <YOUR-API-KEY>
in the interactive examples below with your key.
Remember not to share your API key! Your API key is a secret, and should not be stored or exposed in a public manner.
SELECT COUNT(*) from ethereum.nfts;
curl --request POST \
--data '{"sql": "SELECT COUNT(*) from ethereum.nfts;", "options": {"timeout": 2}}' \
--url 'https://api.transpose.io/sql' \
--header 'Content-Type: application/json' \
--header 'x-api-key: BtRVYj7dgnYUcr1gSSfWhmrTShIb8RBG' \
Got questions? Join our Discord
Discord is the primary home of the Transpose developer community. Join us to ask questions, share your work, and get help.