API Documentation

Integrate your custom-built store with VaanijyaSetu using our REST API. Push orders, fetch products, check stock, and track shipments — all with simple HTTP calls.

Who is this for? This API is for clients with custom-built stores (not WooCommerce or Shopify). If you use WooCommerce or Shopify, use the built-in connectors in your dashboard instead.

Overview

The VaanijyaSetu API lets your custom store:

All prices returned by the API are wholesale prices based on your subscription plan. You set your own selling prices on your store — VaanijyaSetu only charges you wholesale + delivery.

Authentication

All API requests require two headers:

  1. An Authorization header carrying your Bearer Token.
  2. An X-Client-Domain header carrying the domain your token is registered to (the same domain you registered with VaanijyaSetu, e.g. yourstore.com or yourstore.myshopify.com).

You can find both your Bearer Token and your registered domain in your VaanijyaSetu dashboard under API Access.

Headers Authorization: Bearer your_bearer_token_here X-Client-Domain: yourstore.com

The X-Client-Domain value is compared case-insensitively after stripping any https:// / http:// prefix and any leading www.. Requests with a missing or mismatched domain will receive 403 Forbidden.

Keep your token secret. Never expose it in frontend JavaScript or client-side code. Always make API calls from your server backend.

Base URL

https://vaanijyasetu.com/api

All endpoints below are relative to this base URL.

Error Handling

The API uses standard HTTP status codes. Error responses include a JSON body:

CodeMeaning
200Success
201Created (order placed successfully)
401Unauthorized — invalid or missing token
403Forbidden — no active subscription or domain mismatch
404Not found — product/order doesn't exist
409Conflict — duplicate order (same store_order_id)
422Validation error — missing or invalid fields

List All Products

GET /api/products
Returns all active products with wholesale prices for your plan.

Example Request

cURL curl -X GET https://vaanijyasetu.com/api/products \ -H "Authorization: Bearer your_token" \ -H "X-Client-Domain: yourstore.com"

Example Response

JSON { "status": true, "total": 42, "data": [ { "id": 1, "sku": "BLV-NEW-L8MW", "name": "New Child Cap", "description": "...", "category": "Kids Wear", "stock_qty": 150, "images": ["https://..."], "pricing": { "wholesale_price": 80.00, "currency": "INR" } } ] }

Get Single Product

GET /api/products/{sku}
Returns full details for a single product, including variations and delivery charge.

Example Response

JSON { "success": true, "data": { "sku": "BLV-WOM-OM20", "name": "Women's Blue Shoes", "stock_qty": 63, "has_variations": true, "variations": [ { "name": "Color", "values": ["red", "green", "orange"] }, { "name": "Size", "values": ["7", "8", "9"] } ], "variation_stocks": { "Color:red|Size:7": 10, "Color:red|Size:8": 15 }, "delivery_charge": 49.00, "pricing": { "wholesale_price": 150.00 } } }

Check Stock

GET /api/products/{sku}/stock
Quick stock check. Returns current quantity and per-variation breakdown.

Example Response

JSON { "success": true, "sku": "BLV-WOM-OM20", "stock_qty": 63, "in_stock": true, "has_variations": true, "variation_stocks": { "Color:red|Size:7": 10, "Color:red|Size:8": 15, "Color:green|Size:7": 5 } }

Create Order

POST /api/orders
Push a customer order from your store into VaanijyaSetu. You only send SKU + quantity — we calculate the wholesale cost automatically.
Tamper-proof pricing. You never send prices. The API looks up wholesale prices server-side based on your plan. The order total is always: wholesale price × quantity + delivery charge.

Request Body

FieldTypeRequiredDescription
customer.namestringYesCustomer full name
customer.phonestringYesCustomer phone number
customer.emailstringNoCustomer email
shipping.addressstringYesFull street address
shipping.citystringYesCity name
shipping.statestringYesState name
shipping.pincodestringYesPIN code
shipping.countrystringNoDefault: India
items[].skustringYesProduct SKU (e.g. BLV-NEW-L8MW)
items[].quantityintegerYesQuantity ordered
items[].variationstringNoVariation info (e.g. "red / 7")
store_order_idstringNoYour store's order ID (for duplicate prevention)
notesstringNoSpecial instructions

Example Request

cURL curl -X POST https://vaanijyasetu.com/api/orders \ -H "Authorization: Bearer your_token" \ -H "X-Client-Domain: yourstore.com" \ -H "Content-Type: application/json" \ -d '{ "customer": { "name": "Rahul Sharma", "phone": "9876543210", "email": "rahul@gmail.com" }, "shipping": { "address": "123 MG Road, Near City Mall", "city": "Mumbai", "state": "Maharashtra", "pincode": "400001" }, "items": [ { "sku": "BLV-NEW-L8MW", "quantity": 2 }, { "sku": "BLV-WOM-OM20", "quantity": 1, "variation": "red / 7" } ], "store_order_id": "MYSTORE-1234" }'

Example Response

JSON — 201 Created { "success": true, "order_number": "API-A1B2C3D4E5F6", "subtotal": 310.00, "delivery": 49.00, "total": 359.00, "items_count": 2, "status": "awaiting_payment", "message": "Order created. Please pay via the VaanijyaSetu dashboard." }
After creating an order: The client logs into VaanijyaSetu, reviews the order, and pays via wallet or Razorpay. Once paid, VaanijyaSetu ships directly to the customer.

Check Order Status

GET /api/orders/{order_number}/status
Get the current status, items, and shipment tracking for an order. You can use either the VaanijyaSetu order number or your store_order_id.

Example Response

JSON { "success": true, "order_number": "API-A1B2C3D4E5F6", "store_order_id": "MYSTORE-1234", "status": "shipped", "payment_status": "paid", "total_amount": 359.00, "tracking": { "courier": "Delhivery", "tracking_number": "DL1234567890", "tracking_url": "https://www.delhivery.com/track/...", "shipped_at": "2026-04-18T10:30:00Z" }, "timeline": [ { "status": "awaiting_payment", "changed_at": "..." }, { "status": "pending", "changed_at": "..." }, { "status": "shipped", "changed_at": "..." } ] }

Integration Flow

Here's the recommended integration flow for custom stores:

  1. Setup: Register on VaanijyaSetu, subscribe to a plan, get your API credentials from the API Access page
  2. Sync catalog: Call GET /api/products to fetch products. Display them on your store with your own selling prices
  3. Stock check: Before order placement, call GET /api/products/{sku}/stock to verify availability
  4. Push orders: When a customer orders on your store, call POST /api/orders with customer details and SKUs
  5. Payment: Log into VaanijyaSetu dashboard and pay for the order using wallet or Razorpay
  6. Track shipment: Poll GET /api/orders/{id}/status to get tracking info and update your customer
Periodic stock sync: We recommend calling the stock check endpoint every 15-30 minutes via a cron job to keep your store's stock levels accurate. This prevents overselling.

Webhooks (Optional)

Currently, order status updates are available via polling the status endpoint. If you need real-time webhook notifications for order status changes (shipped, delivered, etc.), contact us at admin@vaanijyasetu.com to discuss a custom integration.