English
Deep Pagination Documentation
About 189 wordsLess than 1 minute
2026-01-19
Solution for List Query Offset Range Exceeding 10000 (Deep Pagination)
Background: When clients call query APIs to retrieve large datasets, the offset in query conditions may continuously increase with each call, leading to prolonged query times and excessive database pressure that affects normal service operations.
API Response:
{
"errorDescription": "offset cannot exceed 10000",
"errorMessage": "offset out of range 10000",
"errorCode": 10013
}Solution:
Add _id sorting to the "search_query_info" query condition ("orders": [ { "fieldName": "_id", "isAsc": true } ]), keep offset as 0 ("offset": 0), and include the _id value of the last record from the previous query result ("filters": [ { "operator": "GT", "field_name": "_id", "field_values": [ "last_record_id_from_previous_query" ] } ]) for pagination.
Example: "search_query_info": { "limit": 5, "offset": 0, "filters": [ { "operator": "GT", "field_name": "_id", "field_values": [ "0329115a0d70455f9852bbcbbaf452e0" ] } ], "orders": [ { "fieldName": "_id", "isAsc": true } ]}
Code Example:
Taking customer list query as an example, first query:
Request:
{
"data": {
"dataObjectApiName": "AccountObj",
"find_explicit_total_num": false,
"search_query_info": {
"limit": 5,
"offset": 0,
"filters": [],
"orders": [
{
"fieldName": "_id",
"isAsc": true
}
],
"fieldProjection": [
"_id"
]
}
}
}Response:
{
"traceId": "E-O.74164.1063-61c99d4033ca46c5",
"data": {
"dataList": [
{
"_id": "0039b47555cf4be98b8ff85d1ca70144"
},
{
"_id": "00d031875c924725b23355bbcff562e4"
},
{
"_id": "0154bfc178134deabf23e5cff7844622"
},
{
"_id": "01d92e8210cd4a2495fd893433ac285d"
},
{
"_id": "0329115a0d70455f9852bbcbbaf452e0"
}
],
"offset": 0,
"limit": 5,
"total": 0
},
"errorDescription": "success",
"errorMessage": "OK",
"errorCode": 0
}