TypeScript SDK
@pckt-sh/sdk is the official client for TypeScript and JavaScript. It's generated from the same OpenAPI spec as these docs, so every endpoint has a typed function and typed parameters and responses. It's republished automatically whenever the API changes.
Installation
Configure your API key
Set your key once on the shared client. Every call made afterwards sends it as a Bearer token. Don't have a key yet? See Authentication.
Use the SDK from server-side code (Node.js, Bun, Deno, edge functions). Shipping your API key in browser code would let anyone spend your credits.
Make your first request
Each call returns { data, error } instead of throwing, so failures are values you handle explicitly. Query parameters go in query, typed exactly as documented on each endpoint page.
Finding the right function
Functions are named after the service and method of each endpoint. Your editor's autocomplete lists them all after import { } from "@pckt-sh/sdk".
| Endpoint | SDK function |
|---|---|
| GET /v1/stockx/search | stockXServiceSearch() |
| GET /v1/stockx/product | stockXServiceGetProduct() |
| GET /v1/goat/search | goatServiceSearch() |
| GET /v1/shopify/product | shopifyServiceGetProduct() |
Throwing on errors
Prefer try/catch? Pass throwOnError: true and data is always defined on success.
Multiple keys or base URLs
Create a dedicated client and pass it per call, for example to use a different API key per customer or environment.
Need an API key?
Sign up for free and get 500 requests/month.