Skip to content
Last updated

List endpoints support limit/offset pagination to efficiently handle large datasets.

Parameters

ParameterTypeDefaultMaxDescription
limitinteger100100Number of records to return per page (1-100)
offsetinteger0-Number of records to skip before starting to return results

Maximum Limit: The limit parameter is capped at 100. If you request more than 100 items, the API will return 100 items.

How It Works

  • Page 1: offset=0, limit=100 → Returns records 1-100
  • Page 2: offset=100, limit=100 → Returns records 101-200
  • Page 3: offset=200, limit=100 → Returns records 201-300

Example

# First page (default)
curl "https://api.dualentry.com/public/v1/invoices" \
  -H "X-API-KEY: your_api_key_here"

# Custom page size
curl "https://api.dualentry.com/public/v1/invoices?limit=50&offset=100" \
  -H "X-API-KEY: your_api_key_here"

Response Format

List endpoints return an array of resources:

[
  {
    "id": "inv_001",
    "customer": "Customer A",
    "total": 1500.00
  },
  {
    "id": "inv_002",
    "customer": "Customer B",
    "total": 2300.00
  }
]

Fetching All Records

Continue fetching pages until you receive an empty array or fewer records than requested:

all_records = []
offset = 0
limit = 100

while True:
    response = requests.get(
        "https://api.dualentry.com/public/v1/invoices",
        headers=headers,
        params={"limit": limit, "offset": offset}
    )
    
    records = response.json()
    if not records:
        break
    
    all_records.extend(records)
    
    if len(records) < limit:
        break
    
    offset += limit

Best Practice: When fetching all records, add delays between requests to respect rate limits.

Validation Errors

Invalid pagination parameters will return a 400 Bad Request error:

Invalid RequestError Message
limit=0Input should be greater than or equal to 1
limit=-1Input should be greater than or equal to 1
offset=-1Input should be greater than or equal to 0

Note: Requesting limit > 100 will not return an error. The limit will be silently capped at 100.

Example error response:

{
  "success": false,
  "errors": {
    "__all__": ["greater_than_equal query.limit: Input should be greater than or equal to 1"]
  }
}

Next: Learn about Errors →