Search Documentation
Search for a documentation page...
Commerce SDK Overview
The Commerce SDK is a typed TypeScript client for the YNS API. Zero-config setup, full type safety.
What is the Commerce SDK?
The Commerce SDK (commerce-kit) is a lightweight TypeScript client that wraps the YNS REST API. It provides typed methods for every endpoint, automatic environment detection, and zero-config initialization.
Installation
Quick Start
Configuration
The SDK reads YNS_API_KEY from your environment by default:
Environment Detection
The SDK automatically detects staging vs production based on your API key prefix:
sk-...connects toyns.store(production)sk-s-...connects toyns.cx(staging/sandbox)
Available Methods
| Category | Methods |
|---|---|
| Products | productBrowse, productGet, productCreate, productUpdate, productDelete |
| Cart | cartUpsert, cartGet, cartRemoveItem |
| Orders | orderBrowse, orderGet, orderUpdate |
| Collections | collectionBrowse, collectionGet, collectionCreate |
| Categories | categoriesBrowse, categoryGet, categoryCreate, categoryUpdate |
| Customers | customerBrowse, customerGet, customerUpdate, customerAddressCreate, customerAddressDelete, customerOrdersBrowse |
| Posts | postBrowse, postGet, postCreate, postUpdate, postDelete |
| Inventory | inventoryBrowse, inventoryAdjust |
| Variants | variantGet, variantCreate, variantUpdate, variantDelete |
| Subscribers | subscriberCreate, subscriberDelete |
| Utility | meGet, request |
Raw Requests
For endpoints not yet wrapped, use the escape hatch: