Documentation Index
Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt
Use this file to discover all available pages before exploring further.
Loading the SDK
Script Tag (Recommended)
/sdk/v1.js. The CDN version ensures you always run a compatible release.
ES Module Import
Constructor Options
How appId is Resolved
The SDK reads appId from window.__HASP__.appId, which is injected by Hasp when your app is served. You never set this yourself. If appId cannot be resolved, the constructor throws immediately with ErrorCode.MissingAppId.
Retry Behavior
The SDK retries automatically for:429 Rate Limited— respectsRetry-Afterheader if present (integer seconds or HTTP-date)502 Bad Gateway— network infrastructure hiccups- Network failures (device offline, DNS failure) — for
GETand single-recordDELETEonly (idempotent)
POST, PATCH, and bulk DELETE are not retried on network failure to avoid double-writes. Single-record DELETE is retried because it is idempotent.
503 Maintenance is never retried — the SDK enters maintenance mode immediately.
Cleanup
Calldestroy() when your app unmounts to abort all in-flight requests and clear event handlers:
AbortError. After destroy(), maintenance event handlers are also cleared.