Several Henry operations are async - they return immediately with a refId and a status, and results arrive once processing completes. You poll the corresponding poll* endpoint until status reaches a terminal state.Operations that follow this pattern:
All async operations support mode: "sync", which blocks the request for up to 30 seconds until the operation completes. If the result is ready within that window, you get it in a single call with no polling needed.
const search = await henry.products.search({ type: 'global', filters: { type: 'text', query: 'Nike Air Max' }, mode: 'sync',});// If completed within 30s, result is already populatedif (search.status === 'complete') { console.log(search.result?.products);}
If the operation doesn’t complete within 30 seconds, sync mode returns with a non-terminal status (pending or processing) and you’ll need to fall back to polling. For operations that reliably take longer (e.g. headless checkout), prefer mode: "async" with the poll helper below.
The pollJob helper defaults to 1s intervals and 60 attempts, which works for most cases. Product search and details typically complete in 2–5 seconds; orders take longer since Henry places them with the merchant.For order fulfillment, consider skipping polling entirely - Webhooks let Henry push results to you instead.