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
Every method is typed against the REST API it wraps — see the API Reference for parameters and response shapes.
| Category | Methods |
|---|---|
| Store | meGet, socialsGet |
| Products | productBrowse, productGet, productCreate, productUpdate, productDelete, productBatch, productFilters |
| Variants | variantGet, variantCreate, variantUpdate, variantDelete |
| Inventory | inventoryBrowse, inventoryAdjust |
| Collections | collectionBrowse, collectionGet, collectionCreate, collectionUpdate, collectionDelete, collectionImportMemberships |
| Categories | categoriesBrowse, categoryGet, categoryCreate, categoryUpdate, categoryDelete |
| Brands | brandBrowse, brandGet, brandCreate, brandUpdate, brandDelete, brandAssignProducts |
| Search | search |
| Reviews | productReviewsBrowse, productReviewCreate |
| Cart | cartUpsert, cartGet, cartAddBundle, cartRemoveItem, cartDelete |
| Orders | orderBrowse, orderGet, orderUpdate, orderRefundsBrowse, orderRefundGet |
| Customers | customerBrowse, customerGet, customerUpdate, customerAddressCreate, customerAddressDelete, customerOrdersBrowse |
| Coupons | couponBrowse, couponGet, couponCreate, couponUpdate, couponDelete |
| Events & tickets | eventBrowse, eventGet, eventCreate, eventUpdate, eventAttendeesBrowse, ticketsGet, ticketsUpdate, ticketAttendeeGet |
| Blog | postBrowse, postGet, postCreate, postUpdate, postDelete, postCommentsBrowse, postCommentCreate, blogCategoryBrowse, blogCategoryGet, blogCategoryCreate, blogCategoryUpdate, blogCategoryDelete |
| Marketing | subscriberCreate, subscriberDelete, contactMessageCreate |
| Legal pages | legalPageBrowse, legalPageGet, legalPageCreate, legalPageUpdate |
| Support | supportCaseBrowse, supportCaseGet, supportCaseCreate, supportCaseUpdate, supportCaseReply |
| Add-ons | instaviewImagesBrowse |
| Utility | request |
Browse methods list and paginate, Get fetches one record, and Create/Update/Delete do what they say.
Raw Requests
For endpoints not yet wrapped, use the escape hatch: