Skip to main content

ShopiError

All SDK errors are instances of ShopiError. Use instanceof to catch them cleanly.

Status codes

StatusMeaningWhat to do
0Network error — offline, DNS failureCheck connectivity, retry
401Invalid or missing API keyCheck the key starts with shopi_pk_
403Key does not have required scopeContact shop owner to regenerate key
404Resource not foundCheck slug or ID is correct
408Request timed outIncrease timeoutMs or retry
429Rate limit exceededWait for Retry-After seconds
500Server errorRetry with backoff
502Upstream unavailableRetry — transient infrastructure issue

Automatic retries

The SDK automatically retries 500, 502, 503, 504, and 429 responses up to 2 times with exponential backoff (300ms, then 600ms). You do not need to implement retry logic yourself. For 429 responses, the SDK reads the Retry-After header and waits the correct amount of time before retrying.

Timeout

Every request times out after 10 seconds by default. A timed-out request throws ShopiError with status: 408.

Full error handling example