Pagination
Overview
To improve performance and avoid timeouts on endpoints that return large datasets, Blockdaemon APIs support pagination.
Pagination breaks responses into smaller, more manageable chunks. This reduces load times, avoids timeouts, and provides a faster response. If more results are available, the response will include a next_page_token
, which you can use to fetch the next response.
Note:Each paginated request may consume compute units (CUs), Monitor your usage when working with large datasets. See API Suite dashboard doc for reference.
How Pagination Works
- Send a request with an optional
page_size
. - If more results are available, the response includes a
next_page_token
. - Pass that token as the
page_token
in the next request. - Repeat the process until no token is returned.
Parameters
Name | Type | Required | Description |
---|---|---|---|
page_size | Integer | No | Max number of items per response. Defaults to 25, capped at 100. |
page_token | String | No | Token used to get the next page. You got this from the next_page_token field in the previous response. |
Where Pagination Is Available
- REST API
- RPC API
Tips
- Use
page_size
to control how much data you receive. Start small if you're unsure.- Always check for
next_page_token
before sending another request.- Stop paginating when no token (
next_page_token
) is returned.
Examples
Here is an example of how to make a paginated request using the Get a List of Transaction Inputs and Outputs endpoint:
- Send an API request.
curl --request GET \
--url 'https://svc.blockdaemon.com/universal/v1/bitcoin/mainnet/account/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa/utxo?spent=false&check_mempool=false&from=961846434&to=1119612834&order=desc&page_size=3' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'accept: application/json'
- The response will include a
next_page_token
which can be used to retrieve more items in subsequent requests. Here is a sample response:
{
"total": 3,
"data": [
{
"status": "mined",
"is_spent": false,
"value": 546,
"mined": {
"index": 0,
"tx_id": "385e7bfe62c8743b0bd5d3f4594ada38b2eb0764c4d89061591c11ba851c1ae0",
"date": 1690886734,
"block_id": "000000000000000000037cd5a51126baf707ae6ba6f3ab30738fc8bd689185c4",
"block_number": 801188,
"confirmations": 24,
"meta": {
"addresses": [
"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
],
"index": 0,
"script": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac",
"script_type": "pubkeyhash"
}
}
},
{
"status": "mined",
"is_spent": false,
"value": 954,
"mined": {
"index": 0,
"tx_id": "982c91b83f1e73eae8e8b0a24b5b1c13f6e0d6cd691b420f5f74a749aed9d0f4",
"date": 1690825153,
"block_id": "000000000000000000041b17b5d048819e4672d23ca3a0e1672617f1661e3899",
"block_number": 801101,
"confirmations": 111,
"meta": {
"addresses": [
"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
],
"index": 0,
"script": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac",
"script_type": "pubkeyhash"
}
}
},
{
"status": "mined",
"is_spent": false,
"value": 546,
"mined": {
"index": 0,
"tx_id": "6ea5c5ab313b8982ca88f311a45f6dadc571d3e288809c9bc240c551cab839ca",
"date": 1690741749,
"block_id": "000000000000000000000663d5e45c2c6cb11436d7aff7a71db07c70027ab5e3",
"block_number": 800942,
"confirmations": 270,
"meta": {
"addresses": [
"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
],
"index": 0,
"script": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac",
"script_type": "pubkeyhash"
}
}
},
],
"meta": {
"paging": {
"next_page_token": "b2d0e8bb9bcece54157064c82f2739ba3ca8d60a004940dfeee7ceb396714234-0-799694"
}
}
}
- Copy the token from the
next_page_token
and add into thepage_token
query parameter in the next request. Here is an example:
curl --request GET \
--url 'https://svc.blockdaemon.com/universal/v1/bitcoin/mainnet/account/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa/utxo?spent=false&check_mempool=false&from=961846434&to=1119612834&order=desc&page_token=b2d0e8bb9bcece54157064c82f2739ba3ca8d60a004940dfeee7ceb396714234-0-799694&page_size=3' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'accept: application/json'
- This request will return the next set of items from the last response.
OFAC ScreeningAs part of our compliance requirements, any API requests made to a sanctioned address will be automatically blocked.
This screening applies to all write operations made through our APIs. Read-only requests that do not involve written actions to the blockchain will not be affected.
If you have questions or need support, please contact us.
👋 Need Help?
Contact us through email or our support page for any issues, bugs, or assistance you may need.
Updated 26 days ago