--- title: "Paging and limiting an API request" slug: "paging-and-limiting-an-api-request" tags: ["paging", "limiting"] updated: 2024-08-19T12:50:07Z published: 2024-08-19T12:50:07Z canonical: "support.lusid.com/paging-and-limiting-an-api-request" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.lusid.com/llms.txt > Use this file to discover all available pages before exploring further. # Paging and limiting an API request ### Introduction Some of LUSID's endpoint have the potential to return a very large number of results. For example, the **list instruments** or **list quotes** end-points could return thousands (or even millions) of results from one request. To help manage these requests, you can set limits on your requests to return X number of results and then use a pagination token to collect the next "page" of results from the same query. ### The page and list parameters The relevant LUSID APIs have two parameters to control pagination: - *Limit* - you can specify how many results you want returned with the **limit** parameter. For example, calling [list quotes](https://www.lusid.com/docs/api/#operation/ListQuotes) has the potential to return thousands of results. You can set limit=100 to return the first 100 results only. - *Page* - you can pass a pagination token to a request via the **page** parameter to continue listing results from a previous call which was limited. Continuing the list quotes example above, you could take the pagination token from your first response and pass this to your second request using the **page** parameter to list the next 100 results. ### Paging with API parameters If a pagination token is provided in a request, you are not allowed to change the api parameters passed from the initial request in the pagination series. ### Automatic limiting To optimise system performance, many of LUSID's APIs will automatically implement a limit even if you do not specify one. For example, the [list instruments](https://www.lusid.com/docs/api/#operation/ListInstruments) API has an automatic limit of 2,000 instrument items in its response. As above, you can use the pagination token to collect more results if your request is limited. ### Example You can see an example below of a list instruments response which has a **next_page** and a **previous_page** token. The next_page will be blank if this is the last page. *Response 1: List instruments response with next_page and previous_page* ```json    "next_page": "ABC123==",    "previous_page": "DEF123==",    "values": [        {            "href": "https://testdomain.lusid.com/api/api/instruments/LusidInstrumentId/CCY_AED",            "identifiers": {                "Currency": "AED",                "LusidInstrumentId": "CCY_AED"            },            "instrument_definition": null,            "links": null,            "lookthrough_portfolio": null,            "lusid_instrument_id": "CCY_AED"        }    ] ``` For a fully worked example, please see the [paging and limiting LUSID's API calls](https://github.com/finbourne/sample-notebooks/blob/master/examples/features/core-lusid/Paging%20and%20limiting%20LUSID%27s%20API%20calls.ipynb) notebook on the FINBOURNE GitHub page.