AstroSell Commerce API
Sell digital goods programmatically. List and create products, manage shared serial warehouses, restock instantly, and read your orders and coupons — over a predictable, key-authenticated REST API.
Introduction
The AstroSell API is organized around REST. It has predictable, resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP verbs and status codes.
All requests go to https://api.astrosell.io/api/v1 and must be sent over HTTPS. Authenticate with a secret API key you generate in your dashboard under Settings → API — every key is scoped to your shop.
Authentication
Authenticate every request with your secret key in the Authorization header as a Bearer token (the X-API-Key header works too). Keys carry full access to your shop — keep them secret and never ship them in client-side code or commit them to version control.
Generate and revoke keys anytime from your dashboard under Settings → API. A revoked key stops working immediately. Keys are shown only once at creation, and start with nsk_.
Errors & rate limits
AstroSell uses conventional HTTP status codes. 2xx means success, 4xx indicates a problem with your request (a missing field, an invalid or revoked key, a resource that doesn’t exist), and 5xx signals an error on our side. Every error returns a JSON body with a human-readable message.
The API is rate limited per key. If you exceed the limit you’ll receive a 429 — back off briefly and retry.
List products
GETReturns every product in your shop, newest first. For serials-type products, stock is the live count of available items in the linked warehouse; service, file and dynamic products are unlimited.
Retrieve a product
GETFetches a single product by its id, including its stock items — the actual serials drawn from the product’s warehouse (or its inline stock for legacy products).
Create a product
POSTCreates a product in your shop. For serials, pass "stock" (newline-separated keys) to auto-create a dedicated warehouse, or "warehouseId" to draw from an existing shared pool. Other types (service, file, dynamic) are unlimited and need no stock.
Update a product
PUTUpdates any subset of a product’s fields — only the keys you send are changed. Pass warehouseId to relink the serials pool, or null to unlink it.
Delete a product
DELETEPermanently deletes a product. If it had an auto-created warehouse that no other product uses, that warehouse is removed too; shared warehouses are left intact.
Add product stock
POSTAppends serials to a serials-type product. If the product is backed by a warehouse the keys are added there (restocking every linked product); otherwise they’re added to the product’s own pool. Duplicates can be removed automatically.
List categories
GETReturns your storefront categories (collections), sorted by sortOrder then name.
Create a category
POSTCreates a storefront category that buyers can filter products by.
Update a category
PUTRenames or reorders a category.
Delete a category
DELETEDeletes a category and unassigns it from every product that used it.
List warehouses
GETLists your warehouses — shared serial pools that one or more products can draw stock from. Newest first.
Create a warehouse
POSTCreates a shared serial pool you can attach to products. Seed it with stock immediately and configure dedup, sold-key removal and a low-stock threshold.
Retrieve a warehouse
GETFetches a single warehouse by id, including its current stock items and settings.
Get warehouse stock
GETReturns the live serial pool for a warehouse — the available, undelivered keys.
Add warehouse stock
POSTAppends serials to a warehouse. Every product linked to the pool is restocked automatically.
Update a warehouse
PUTUpdates a warehouse’s settings (not the serials themselves — use the stock endpoints for those).
Delete a warehouse
DELETEDeletes a warehouse. Returns 409 while any product is still linked to it — unlink those products first.
List orders
GETReturns your shop’s orders, newest first. Filter by status and cap the page size with limit.
Retrieve an order
GETFetches a single order by its invoice id, including its status and — once completed — the delivered items.
List customers
GETReturns your shop’s buyers, newest first, with their store-credit balance and lifetime spend.
Retrieve a customer
GETFetches a single customer by id, with their balance, order count and lifetime spend.
List coupons
GETReturns every coupon in your shop with its discount, limits and usage.
Create a coupon
POSTCreates a discount code. Use isFixed:true for a flat amount off, or leave it false for a percentage (0–100). maxUses:0 means unlimited.
Retrieve a coupon
GETFetches a single coupon by id.
Update a coupon
PUTUpdates a coupon’s discount, limits or active state.
Delete a coupon
DELETEPermanently deletes a coupon code.
Ready to build?
Generate a key in your dashboard and make your first call in under a minute.