SDKs & Libraries
Client libraries for Node.js and Python are in development. Until they ship, call the REST API directly — the cURL examples below cover the same workflows.
SDKs are not published yet
The Node.js and Python packages below are still in development and are not yet available on npm or PyPI. The snippets show the planned interface so you can see where it is heading — they will not run today. For working code, use the cURL examples or the API playground.
What the SDKs will include
Auto-Retry
Failed requests are automatically retried with exponential back-off. Handles 429 and 5xx responses gracefully.
Auto-Pagination
Iterate through paginated endpoints with async iterators. No manual page tracking required.
Webhook Verification
Built-in HMAC-SHA256 signature verification with timing-safe comparison for secure webhook handling.
Full Types
Complete TypeScript definitions and Python type hints for every request, response, and error object.
Typed Errors
Structured error classes for each HTTP status code, making it easy to catch and handle specific failures.
Zero Dependencies
Lightweight SDKs with no external runtime dependencies. Uses native fetch (Node.js) and urllib3 (Python).
Node.js SDK (in development)
Installation
Not yet on npm
@spirestock/sdk has not been published. Watch the changelog for the release.
Requirements
Node.js 18 or later is required. The SDK uses the native fetch API and ES modules.
Quick Start
Authenticate and list recent orders in just a few lines:
import { SpireStock } from "@spirestock/sdk";
const client = new SpireStock({
baseUrl: "https://api.spirestock.com/api/v1",
});
// Authenticate
await client.auth.login({
email: process.env.SPIRESTOCK_EMAIL,
password: process.env.SPIRESTOCK_PASSWORD,
});
// List recent orders
const { data, pagination } = await client.orders.list({
limit: 10,
});
for (const order of data) {
console.log(`${order.order_code} — Status: ${order.order_status} — ₹${order.order_total_amount}`);
}Auto-Pagination
Use the async iterator to page through large result sets without manual offset management:
// Iterate through all orders, fetched in pages of 50
for await (const order of client.orders.listAutoPaginate({ limit: 50 })) {
console.log(order.order_code, order.order_total_amount);
}
// Or collect all into an array
const allOrders = await client.orders
.listAutoPaginate({ limit: 100 })
.toArray();
console.log(`Fetched ${allOrders.length} orders`);Python SDK (in development)
Installation
Not yet on PyPI
The spirestock package has not been published. Watch the changelog for the release.
Requirements
Python 3.9 or later. The SDK ships with full type hints and supports both sync and async usage.
Quick Start
import os
from spirestock import SpireStock
client = SpireStock(base_url="https://api.spirestock.com/api/v1")
# Authenticate
client.auth.login(
email=os.environ["SPIRESTOCK_EMAIL"],
password=os.environ["SPIRESTOCK_PASSWORD"],
)
# List recent orders
response = client.orders.list(limit=10)
for order in response.data:
print(f"{order.order_code} — Status: {order.order_status} — ₹{order.order_total_amount}")
# Auto-pagination
for order in client.orders.list_auto_paginate(limit=50):
print(order.order_code)
# Webhook signature verification
from spirestock.webhooks import verify_signature
is_valid = verify_signature(
payload=raw_body,
signature=headers["X-Webhook-Signature"],
timestamp=headers["X-Webhook-Timestamp"],
secret=os.environ["WEBHOOK_SECRET"],
)cURL Examples
No SDK needed — use cURL directly for quick tests, scripting, or CI/CD pipelines.
Login
curl -X POST https://api.spirestock.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "'$SPIRESTOCK_EMAIL'",
"password": "'$SPIRESTOCK_PASSWORD'"
}'List Orders
curl "https://api.spirestock.com/api/v1/orders?limit=10&page=1" \
-H "Authorization: Bearer YOUR_TOKEN"Create an Order
curl -X POST https://api.spirestock.com/api/v1/orders \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"user_id": 42,
"items": [
{
"product_variant_id": 10,
"quantity": 50
}
],
"delivery_date": "2026-06-02"
}'Export Orders (XLSX)
curl "https://api.spirestock.com/api/v1/exports/orders?format=xlsx" \
-H "Authorization: Bearer YOUR_TOKEN" \
-o orders-export.xlsxReady to build?
Install an SDK and start building your integration. If you run into issues, check the error handling guide or reach out to our developer support team.