Core concepts
API reference
Conventions, pagination, errors and idempotency across the Viraj API.
Base URL and versioning
All requests are served over HTTPS from https://api.viraj.com. The current major version is v1.
Send Viraj-Version with a date to pin behaviour. We never change response shapes inside a pinned version; deprecations are announced at least six months ahead.
GET https://api.viraj.com/v1/orders
Authorization: Bearer vk_live_...
Viraj-Version: 2026-03-01Pagination
List endpoints return cursor pagination. Pass limit (1–100, default 25) and echo next_cursor as cursor to fetch the next page.
Cursors are opaque. Do not parse them or persist them beyond the lifetime of a sync run.
{
"data": [{ "id": "ord_4821", "status": "paid" }],
"has_more": true,
"next_cursor": "cur_9f2c1a"
}Errors
Non-2xx responses use a single envelope with a stable code, a human message and an optional field path. Retry only 429 and 5xx responses.
- 400 validation_failed — fix the request body.
- 401 invalid_key — the key is missing, revoked or from another workspace.
- 403 insufficient_scope — the key lacks the required scope.
- 409 conflict — the resource changed; re-read and retry.
- 429 rate_limited — back off with the Retry-After header.
{
"error": {
"code": "validation_failed",
"message": "price_cents must be a positive integer",
"field": "price_cents",
"request_id": "req_01HZ8..."
}
}Idempotency
POST requests that create money-moving resources accept an Idempotency-Key header. Reusing a key with the same body returns the original response; reusing it with a different body returns 422.
curl -X POST https://api.viraj.com/v1/orders \
-H "Authorization: Bearer $VIRAJ_API_KEY" \
-H "Idempotency-Key: 7d1f2b5e-order-4821" \
-H "Content-Type: application/json" \
-d '{"location_id":"loc_sfo_02","customer_id":"cus_118","lines":[{"sku":"HW-COF-001","quantity":2}]}'Rate limits
Limits are per key and per workspace. Standard keys allow 120 requests per second with bursts of 300. Response headers report the current budget.
- X-RateLimit-Limit — requests allowed in the current window.
- X-RateLimit-Remaining — requests left.
- Retry-After — seconds to wait after a 429.