TypeScript client
This guide is for a developer who would rather not hand-roll fetch calls. @meisei/api is a
typed client for both Meisei APIs, generated from the same OpenAPI documents this
reference is built from, so it never drifts from what the API accepts.
You do not need it. Every endpoint is an ordinary HTTPS request and the reference gives you curl for each one. The client is there so your editor knows the shapes. For Ruby or Python, see Ruby client or Python client.
Install
There are two entry points, one per API:

The admin API
There is no default base URL, so set one before the first call. Keep this on your server. A secret key that reaches a browser has leaked.
Function names follow the method and path, so POST /products/import is
postProductsImport and DELETE /customers/{id} is deleteCustomersById. Path
parameters go in path, query parameters in query, and a request body in body.
Every record the API returns has a type of its own, named for what it is: Review,
Product, Order, LoyaltyMembership and so on. A list response is the record's type in
an array, so getReviews answers { data: Review[]; nextCursor: string | null }. Each
request and response is exported as a type too:
Errors
Calls do not throw on a failed response. Check error and response, which carries the
status:
See Errors for the codes.
The widget API
The widget API takes a publishable key, which is safe to ship to the browser. Customer-specific endpoints also take the signed email and timestamp generated on your backend. From a server you can send a secret key as a bearer token instead of the publishable key. See Authentication.
If you only want the rendered widgets rather than the data behind them, use the widgets package instead. See Storefront widgets for the embed script and React widgets for the React components, which can be dropped in whole or composed from their parts.
React Query
Query and mutation options are generated for both APIs, behind their own entry points so
they load only if you ask for them. @tanstack/react-query version 5 is an optional peer
dependency.
Talking to several organizations
The entry points export one shared client, which suits an application serving a single organization. To hold several at once, build a client each and pass one per call:
If you are building an application many merchants install, use OAuth rather than asking each of them for a secret key. See Authentication.
A worked example
packages/example-custom-store uses this client for its whole integration, in one file.
See Custom integration.