Guides
Integration Best Practices
Rate limiting, caching, error handling, and polling strategies
No Pagination#
List endpoints (listGrants, getAllWallets, etc.) return all results in a single response. There are no limit, offset, or cursor parameters.
Implications:
- Cache responses locally and refresh periodically
- Don't call list endpoints on every page load in your UI
- For large organizations (1000+ grants), responses may be several MB
The examples use the tokuAPI helper from Build a Dashboard, which returns the data field of each response and throws on an error.
Rate Limiting#
By default the API allows 300 requests per minute for the seat your token acts as and 600 requests per minute per IP address, plus at most 200 requests per second from one IP address. Over the limit you get 429 with a Retry-After header (in seconds).
Strategy:
- Batch operations where possible (
batchUpdateRoleInOrg,bulkUploadMultipleWallets,terminateEmployeeGrants) - Space out polling intervals (5-15 minutes, not seconds)
- On
429, wait forRetry-After, then back off exponentially
Token Refresh#
API tokens expire after 30 days. After refresh, your newest working token keeps working for at most 7 more days. Refreshing needs a CLIENT_ORG_ADMIN token and always refreshes your own token; the body is optional.
Set a calendar reminder or cron job to refresh 7 days before expiry. The old token continues working for 7 days after refresh, so there's no downtime during rotation.
Error Handling#
An operation that refuses a request answers { "error": { "message": "..." } }. Refusals from before the operation runs (bad token, unknown endpoint, rate limit) answer { "error": "..." } with a plain string. See Errors.
Don't retry these (fix the request):#
400Bad Request — invalid parameters401Unauthorized — token expired or invalid, or no seat with thex-role-typerole403Forbidden — wrong role for this endpoint404Not Found — resource or endpoint doesn't exist409Conflict — the record already exists
Retry these (with backoff):#
429Too Many Requests — rate limited500on a read — it can be a passing server failure, but requests that fail validation also return500with anerror.message, so stop when the same message comes back
Before retrying a write that returned 500, check whether it already took effect (for example with listGrants after addSingleGrant), so a retry doesn't create it twice.
Common error patterns:#
Idempotency#
| Operation | Idempotent? | Notes |
|---|---|---|
listGrants, getAllWallets, etc. | Yes | GET requests are always safe to retry |
terminateGrant | Yes | Calling it again succeeds and sets the termination date you send |
terminateEmployeeGrants | Yes | Grants already terminated come back in alreadyTerminatedGrantIDs |
addSingleGrant | No | Creates a new grant each time — use unique names to detect duplicates |
createUserRoleInOrg | No | An email that already has a recipient seat returns 409 |
approveWalletRequest | Partially | Approving a wallet that is no longer pending returns an error |
Polling Strategy#
Without webhooks, poll for changes at appropriate intervals:
| Data | Endpoint | Interval | Reason |
|---|---|---|---|
| Grant status | listGrants | 5 min | Vesting events happen on schedule |
| Wallets waiting for a test transaction | getPendingWalletRequests | 2 min | New wallets need a test transaction |
| Wallet test txns | getPendingWalletTestRequests | 2 min | Test sent, waiting for confirmation |
| Org configuration | getOrgWalletInfo | 30 min | Rarely changes |
| Networks/tokens | getNetworksNew | 1 hour | Rarely changes |
External Employee ID#
Always set externalEmployeeID when creating recipients. This is your primary key for correlating Toku data with your HRIS:
Multi-Organization#
Each API token is scoped to one organization. If you manage multiple orgs, you need a separate token for each. Token scoping is enforced server-side — a token for Org A cannot access Org B's data.