NetSuite Pagination: Best Practices

Edited

This guide explains how pagination works for NetSuite integrations in Apideck and outlines best practices to ensure reliable data retrieval.

We support two different pagination mechanisms when working with NetSuite: SOAP and REST pagination and automatically choose which one to use based on how the request is made.

When a request is sent without filters, Apideck uses NetSuite’s SOAP API. When a request includes filters, Apideck switches to NetSuite’s REST API.

SOAP Pagination (Stateful)

SOAP pagination is used by Apideck when calling NetSuite endpoints without filters (for example, /invoices).

  • Key characteristics:

    • Apideck initiates a server-side search session in NetSuite

    • NetSuite returns a searchId that must be reused for subsequent pages

    • The search session expires after 15 minutes of inactivity

    • Once expired, pagination cannot be resumed and a new search is required

REST Pagination (Stateless)

REST pagination is used by Apideck when filters are applied to a request.

Key characteristics:

  • Uses offset/limit–based pagination

  • Does not create a server-side session

  • Has no expiration

  • More reliable for long-running or resumable processes

Common Cause of Pagination Failures

Pagination errors almost always occur when:

  • A pagination cursor is stored

  • The cursor is reused later (minutes, hours, or days later)

  • The underlying NetSuite SOAP session has already expired

Recommended Best Practices

1. Use Filters

Applying filters switches pagination to REST automatically.

Example:

/invoices?filter[updated_since]=2025-01-01

Benefits:

  • Uses REST pagination

  • No session timeout

  • Safer for retries and long-running jobs

Common filters that trigger REST pagination include:

  • filter[updated_since]

  • filter[name]

  • Other supported resource filters

2. Use Smaller Page Sizes

We recommend:

limit=5–20
  • Reduces request duration

  • Helps avoid execution and timeout limits

  • Improves overall reliability

3. Do Not Store or Reuse Cursors

  • Cursors should be used immediately

  • Do not cache cursors in databases or queues

  • Do not resume pagination after long pauses

Correct usage pattern:

  1. Fetch page

  2. Immediately fetch next page using returned cursor

  3. Repeat until no cursor is returned

Was this article helpful?

Sorry about that! Care to tell us more?

Thanks for the feedback!

There was an issue submitting your feedback
Please check your connection and try again.