Developer ToolsFree calculatorPDF, Excel, Word exportNetSuite

NetSuite OAuth 2.0 Access Token Refresh Calculator

OAuth 2.0 access tokens are short lived by design, so every NetSuite integration needs a refresh routine. This calculator shows how much traffic that routine generates and how buffer choices affect it.

Your numbers

minutes

Enter the lifetime your account issues. Check your integration record and response expires_in value.

5 minutes

Refresh this long before expiry to avoid failed calls.

calls/min
integrations

Your results

Refreshes per day
108
Token requests as share of traffic
0.1%
Effective token use window
55 min
API calls served per token
1,650
API calls per day
172,800

Token lifetimes, refresh token validity and grant types differ by flow and account settings. Treat the defaults as placeholders and confirm them in your NetSuite integration record.

Save results:

Refreshes per day vs safety buffer

Sweeps Refresh safety buffer from 0 to 30, holding your other inputs fixed.

NetSuite integration security review

Optional: get a short review of authentication, secrets and token handling in your integration.

Optional. The tool and every export work without this. No spam.

How to use it

Enter the access token lifetime your account issues, which you can read from the expires_in field of a token response. Choose a safety buffer: the number of minutes before expiry at which your client refreshes. Add the typical API call rate for each integration and the number of integrations that hold their own tokens. The tool returns how often tokens are refreshed per day, how many calls each token serves and what share of requests are token requests.

The calculation

The effective window equals the lifetime minus the buffer. Refreshes per integration per day equal 1,440 minutes divided by that window, rounded up. Multiply by the number of integrations for the daily total. A 60 minute token with a 5 minute buffer is refreshed every 55 minutes, which is 27 times a day per integration. Token traffic is tiny compared with API calls, so the point is not cost but correctness: a buffer that is too small is the main source of intermittent authentication failures.

  • Window = lifetime - buffer
  • Refreshes per day = integrations x ceil(1440 / window)
  • Calls per token = calls per minute x window
  • Overhead = refreshes / (refreshes + calls)

Design guidance

Refresh proactively on a timer or before a call when the token is near expiry, and also handle a 401 by refreshing once and retrying. Store tokens in a secret manager, not in code or a shared file. Remember that refresh tokens also expire or can be revoked, so build an alert and a documented re-authorisation path. Use one token cache per integration so that parallel workers do not each request a new token.

Common mistakes

A frequent bug is every worker thread refreshing at once when the token expires, causing a burst of token requests and sometimes invalidating each other. Another is using a clock without allowing for drift between servers. A third is leaving certificates or keys for machine-to-machine flows to expire silently.

  • Share one token cache across workers with a lock
  • Set a buffer larger than your slowest call
  • Alert before certificate or refresh token expiry
  • Log expires_in on every token response

Frequently Asked Questions

How long does a NetSuite OAuth 2.0 access token last?

Access tokens are short lived, commonly about an hour, and the expires_in value in the token response tells you exactly. Read it at runtime rather than hard coding a number.

What buffer should I use?

Choose a buffer longer than your slowest request plus clock drift. Five minutes is a common starting point for tokens that last an hour. Increase it if your calls can run long.

Do refresh tokens expire?

They can expire or be revoked, depending on the grant type and account settings. Build monitoring so an expired refresh token raises an alert rather than silently stopping the integration.

Is token based authentication still an option?

NetSuite supports both token based authentication and OAuth 2.0. Which is right depends on your integration type and policy. Check current guidance for supported methods on your endpoints.

Netray can help review your NetSuite authentication design, token storage and error handling.