Official SDKs
Build faster with SpireStock’s official client libraries for Node.js and Python, or use cURL for quick scripting and testing.
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
Installation
npm install @spirestock/sdkRequirements
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
Installation
pip install spirestockRequirements
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.