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.
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 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.
Add warehouse stock
POSTAppends serials to a warehouse. Every product linked to the pool is restocked automatically.
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 coupons
GETReturns every coupon in your shop with its discount, limits and usage.
Ready to build?
Generate a key in your dashboard and make your first call in under a minute.