https://retellai.com/?utm_source=discord&utm_medium=seo logo
Using the list API returns a 504 error when pullin...
# ❓・ai-evy-support
c
@AI Evy Using the list API returns a 504 error when pulling bigger amounts. Any method we can improve the return success rate ?
a
Thanks for tagging me @clawmaster.. I'll look through relevant sources and get back to you shortly.
### Answer To handle large amounts of data with the List Calls API and avoid 504 errors, use pagination instead of requesting all data at once [(1) ]() . The List Calls API has a limit parameter with a maximum of 1000 calls per request . To retrieve more than 1000 calls, use the
pagination_key
parameter :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const callResponses = await client.call.list() ;
console.log(callResponses) ;
The pagination key is represented by a call id and is exclusive (not included in the fetched calls) . The last call id from the list calls is usually used as pagination key to continue fetching the next page . For handling large datasets efficiently, one community member suggested using the pagination key approach: "use the pagination key. The pagination key to continue fetching the next page of calls. Pagination key is represented by a call id here, and it's exclusive (not included in the fetched calls) . The last call id from the list calls is usually used as pagination key here" [(2) ]() . This approach allows you to break down large requests into smaller, manageable chunks that are less likely to timeout.
​ To learn more, see the sources I considered: [[1] List Calls](https://docs.retellai.com/api-references/list-calls) [[2] Discord message from @theexecutor5677 on 2025-05-04](https://discord.com/channels/1186424376300679209/1186462578310910112/1368489575269535805) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.