JavaScript / TypeScript SDK
@shopimind/sdk-js is the official client for calling the ShopiMind API from Node.js. It is an outbound client: your code talks to the ShopiMind API, authenticated by your shop's API key (spm-api-key header).
- ESM only — Node.js 18+, imported with
import { … } from '@shopimind/sdk-js' - Single runtime dependency:
axios .d.tstypes included — autocompletion and type checking out of the box- Automatic retry, optional chunking, uniform return format (envelope
{ ok, statusCode, data, error })
The base URL is https://core.shopimind.com/v1.
ESM only
The SDK is published exclusively as ESM: require('@shopimind/sdk-js') does not work. Use import, and a Node project configured as a module ("type": "module" in your package.json, or a .mjs extension).
Installation
npm i @shopimind/sdk-jsFor details, registries and version pinning, see Installation.
Quickstart
import { SpmClient, SpmCustomers } from '@shopimind/sdk-js';
// Client for the v1 API, authenticated by the shop's API key (spm-api-key header)
const client = SpmClient.getClient('v1', process.env.SHOPIMIND_API_KEY!);
// Read — paginated list
const res = await SpmCustomers.list(client, { limit: 50 });
if (!res.ok) {
throw new Error(res.error.message); // the SDK never throws: check res.ok
}
console.log(res.data.data); // ⚠️ business payload is double-nested: res.data.data
// Bulk write with automatic chunking
const saved = await SpmCustomers.bulkSave(client, customers, { chunk: true });Two things to keep in mind
- The SDK never throws on an HTTP error: always check
res.okand readres.errorwhen needed. - The business payload is double-nested: the API already wraps its responses, so the useful data lives at
res.data.data.
Why the SDK rather than fetch?
Without the SDK (raw fetch) | With the SDK |
|---|---|
| You manage headers, base URL and serialization | SpmClient.getClient('v1', key) |
| You write your own retries on 408/429/5xx | Built-in exponential retry (with jitter) |
| You chunk your batches by hand | { chunk: true } aligned with the API limits |
try/catch everywhere, varied error shapes | Single envelope { ok, statusCode, data, error } |
| No types | Full DTOs and .d.ts |
Going further
- Installation — registries, versions, prerequisites
- Usage — reading, writing, nested resources
- Resilience — retry, chunking, helpers
- Resources & methods — the full list
- TypeScript — types and examples
- Scope & versions — what the SDK covers
Building an integration?
To receive webhooks from ShopiMind and connect your application to the lifecycle of an installation, use the @shopimind/integration-kit-js JavaScript integration kit: it mounts the webhook server, verifies the HMAC signature, and depends on and re-exports the SDK so you import SDK resources and types straight from the kit. → Integrations guide