Inventory

Stock-on-hand positions (item variant × warehouse). Read-only via the API; uses the stock.read scope (items.read tokens keep working).

GET/api/v1/inventory

List stock positions

Scope: stock.read

Parameters

NameInTypeRequiredDescription
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.
qquerystringOptionalFree-text search on item/variant/warehouse name or code.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2soh001000000000000001",
  "itemVariantId": "clx2var001000000000000001",
  "warehouseId": "clx2wh0001000000000000001",
  "itemId": "clx2itm001000000000000001",
  "itemName": "Cotton Fabric",
  "variantSize": "Blue - 44in",
  "variantSku": "CF-BLUE-44",
  "warehouseName": "Main Warehouse",
  "warehouseCode": "MAIN",
  "quantityOnHand": 40,
  "quantityReserved": 5,
  "quantityAvailable": 35,
  "averageCost": 480.5,
  "lowStockThreshold": 10,
  "lastMovementAt": "2026-08-12T09:30:00.000Z",
  "updatedAt": "2026-08-12T09:30:00.000Z"
}

Possible errors: unauthorized, insufficient_scope, forbidden

GET/api/v1/inventory/{id}

Get a stock position

Scope: stock.read

Adds up to 100 recent inventory movements for this item variant + warehouse, newest first.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredStock-on-hand position ID.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/clx2soh001000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2soh001000000000000001",
  "itemVariantId": "clx2var001000000000000001",
  "warehouseId": "clx2wh0001000000000000001",
  "itemId": "clx2itm001000000000000001",
  "itemName": "Cotton Fabric",
  "variantSize": "Blue - 44in",
  "variantSku": "CF-BLUE-44",
  "warehouseName": "Main Warehouse",
  "warehouseCode": "MAIN",
  "quantityOnHand": 40,
  "quantityReserved": 5,
  "quantityAvailable": 35,
  "averageCost": 480.5,
  "lowStockThreshold": 10,
  "lastMovementAt": "2026-08-12T09:30:00.000Z",
  "updatedAt": "2026-08-12T09:30:00.000Z",
  "movements": [
    {
      "id": "clx2mov001000000000000001",
      "movementType": "PURCHASE_RETURN_OUT",
      "quantity": 10,
      "unitCost": 480,
      "totalCost": 4800,
      "balanceAfter": 40,
      "avgCostAfter": 480.5,
      "sourceDocType": "DEBIT_NOTE",
      "sourceDocId": "clx2dn0001000000000000001",
      "notes": null,
      "createdAt": "2026-08-12T09:30:00.000Z"
    }
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

GET/api/v1/inventory/lots

List stock lots

Scope: stock.read

The Lots page. A member with a warehouse list sees only lots in those warehouses. unitCost needs costPrice.read and value needs stockValue.read; without them the keys are absent.

Parameters

NameInTypeRequiredDescription
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.
qquerystringOptionalLot barcode or item name contains.
statusquerystringOptionalOPEN, EXHAUSTED or VOID. Repeat to match several.
warehouseIdquerystringOptionalOnly lots in this warehouse.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/lots" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2lot001000000000000001",
  "barcode": "OPN-000012",
  "itemName": "Cotton Fabric",
  "variantLabel": "Blue - 44in",
  "warehouseName": "Main Warehouse",
  "vendorName": null,
  "receivedAt": "2026-08-01T00:00:00.000Z",
  "remaining": 40,
  "total": 50,
  "unit": "MTR",
  "unitCost": 480.5,
  "value": 19220,
  "status": "OPEN"
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error

GET/api/v1/inventory/lots/lookup

Find a lot by barcode

Scope: stock.read

Resolves a scanned or typed lot barcode to the lot id. 404 "No lot with code X" when none matches or the lot is outside the member's warehouses.

Parameters

NameInTypeRequiredDescription
codequerystringRequiredThe lot barcode.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/lots/lookup" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2lot001000000000000001"
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found

GET/api/v1/inventory/lots/{id}

Get a stock lot

Scope: stock.read

The lot with its source (BILL, OPENING, PRODUCTION, ...), lineage and movements. unitCost needs costPrice.read and value needs stockValue.read; without them the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredLot ID.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/lots/clx2lot001000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2lot001000000000000001",
  "barcode": "OPN-000012",
  "itemName": "Cotton Fabric",
  "variantLabel": "Blue - 44in",
  "warehouseName": "Main Warehouse",
  "vendorName": null,
  "receivedAt": "2026-08-01T00:00:00.000Z",
  "remaining": 40,
  "total": 50,
  "unit": "MTR",
  "unitCost": 480.5,
  "value": 19220,
  "status": "OPEN",
  "billNumber": null,
  "source": "OPENING",
  "lineage": {
    "mintedBy": null,
    "movedFrom": [],
    "movedTo": [
      "TRF-000003"
    ]
  },
  "movements": [
    {
      "at": "2026-08-01T00:00:00.000Z",
      "type": "OPENING",
      "qty": 50,
      "docNumber": null,
      "note": null
    }
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

GET/api/v1/inventory/valuation

Stock valuation by warehouse

Scope: stock.read

Stock value per warehouse, with each warehouse's share of the total (percent). Also needs stockValue.read: 403 without it. Scoped to the member's warehouses.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/valuation" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "totalQty": 40,
  "totalValue": 19220,
  "rows": [
    {
      "warehouseId": "clx2wh0001000000000000001",
      "warehouseName": "Main Warehouse",
      "qty": 40,
      "value": 19220,
      "share": 100
    }
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden

GET/api/v1/inventory/labels

List barcode label candidates

Scope: stock.read

The Label Studio's pickers: active item variants (up to 500) and, unless groupId is given, open lots with stock left (up to 200). A plain list under data, no paging. Each row has itemVariantId or lotId; barcode is null when barcodes must be generated on the web first. Lots are only those in the member's warehouses. price and mrp are absent without sellingPrice.read. No cost data.

Parameters

NameInTypeRequiredDescription
qquerystringOptionalItem name, SKU or barcode contains; lots match on lot barcode, item name or SKU.
groupIdquerystringOptionalOnly variants of items in this group (and its direct child groups); lots are left out.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/labels" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
[
  {
    "itemVariantId": "clx2var001000000000000001",
    "name": "Cotton Fabric",
    "variantLabel": "Blue",
    "barcode": "00000012",
    "price": 450,
    "mrp": 500
  },
  {
    "lotId": "clx2lot001000000000000001",
    "name": "Cotton Fabric",
    "variantLabel": "Blue",
    "barcode": "OPN-000012",
    "price": 450,
    "mrp": 450
  }
]

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error

POST/api/v1/inventory/labels

Render barcode labels as a PDF

Scope: stock.read

The Label Studio's labels, rendered server-side with the same layout (CODE128 barcode, field order, cost-code cipher, price format). preset is godex-3up-33x25 (three across, 33 x 25 mm), 38x25, 50x25, 50x30 or 50x50 (one across); each page is one strip. fields.name is the product name. Each item has exactly one of itemVariantId or lotId, and copies from 1 to 999; at most 2000 labels per request (422). Any row without a barcode is a 422 "Generate barcodes on the web first". An item or lot outside the organization or the member's warehouses is a 404. fields.costCode needs costPrice.read, and fields.price or fields.mrp need sellingPrice.read (403 without them). A barcode CODE128 cannot encode (for example non-Latin text) is a 422 "Barcode X can't be printed". storeName prints when fields.storeName is on, else the organization name.

Request body

FieldTypeRequiredConstraints
presetstringRequiredone of: godex-3up-33x25, 38x25, 50x25, 50x30, 50x50
fieldsobjectRequired—
namebooleanRequired—
sizebooleanRequired—
barcodebooleanRequired—
pricebooleanRequired—
mrpbooleanRequired—
costCodebooleanRequired—
storeNamebooleanRequired—
storeNameanyOptional—
itemsarrayRequired—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/labels" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "preset": "godex-3up-33x25",
  "fields": {
    "name": true,
    "size": true,
    "barcode": true,
    "price": true,
    "mrp": true,
    "costCode": false,
    "storeName": false
  },
  "storeName": "Main Store",
  "items": [
    {
      "itemVariantId": "clx2var001000000000000001",
      "copies": 3
    },
    {
      "lotId": "clx2lot001000000000000001",
      "copies": 1
    }
  ]
}'

Example response

Binary response — application/pdf. The labels as a PDF (one page per strip of labels), streamed inline as labels.pdf.

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found

GET/api/v1/inventory/adjustments

List stock adjustments

Scope: stock.read

The Stock Adjustments page, newest first: one row per stock movement an adjustment wrote. Scoped to the member's warehouses.

Parameters

NameInTypeRequiredDescription
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/adjustments" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2mov001000000000000001",
  "date": "2026-08-12T09:30:00.000Z",
  "itemName": "Cotton Fabric",
  "variantLabel": "Blue - 44in",
  "warehouseName": "Main Warehouse",
  "direction": "IN",
  "qty": 10,
  "reason": "RECOUNT",
  "notes": "Found a box in the back room"
}

Possible errors: unauthorized, insufficient_scope, forbidden

POST/api/v1/inventory/adjustments

Record a stock adjustment

Scope: inventory.create

Adds (IN) or removes (OUT) stock at one warehouse. reason is SHRINKAGE, DAMAGE, RECOUNT, CORRECTION or OTHER. unitCost is required on IN lines for a member with costPrice.read (0 uses the current average cost); without costPrice.read it is ignored. Answers the ids of the movements written. 404 when the warehouse is unknown or outside the member's scope; 409 when an OUT would take stock below zero.

Request body

FieldTypeRequiredConstraints
warehouseIdstringRequiredmin length 1; max length 30
reasonstringRequiredone of: SHRINKAGE, DAMAGE, RECOUNT, CORRECTION, OTHER
notesanyOptional—
linesarrayRequired—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/adjustments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "warehouseId": "clx2wh0001000000000000001",
  "reason": "RECOUNT",
  "notes": "Found a box in the back room",
  "lines": [
    {
      "itemVariantId": "clx2var001000000000000001",
      "direction": "IN",
      "qty": 10,
      "unitCost": 480
    }
  ]
}'

Example response

JSON
{
  "ids": [
    "clx2mov001000000000000001"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

GET/api/v1/inventory/opening-stock

List variants to seed with opening stock

Scope: inventory.create

The Opening Stock page: inventory-tracked variants with their placeholder cost (purchasePrice). Needs costPrice.read as well as inventory.create: 404 without it. 404 when the warehouse is unknown or outside the member's scope.

Parameters

NameInTypeRequiredDescription
warehouseIdquerystringRequiredThe warehouse to seed.
qquerystringOptionalItem name, SKU or size contains.
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/opening-stock" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "itemVariantId": "clx2var001000000000000001",
  "itemName": "Cotton Fabric",
  "variantLabel": "Blue - 44in",
  "sku": "CF-BLUE-44",
  "purchasePrice": 480
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found

POST/api/v1/inventory/opening-stock

Seed opening stock

Scope: inventory.create

One-time seeding of quantity and per-unit cost (0 or more) at a warehouse; answers { seeded }, the number of lines. Needs costPrice.read as well as inventory.create: 403 without it. 409 when a variant already has stock in that warehouse, so a repeated request cannot seed twice. 404 when the warehouse is unknown or outside the member's scope.

Request body

FieldTypeRequiredConstraints
warehouseIdstringRequiredmin length 1; max length 30
linesarrayRequired—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/opening-stock" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "warehouseId": "clx2wh0001000000000000001",
  "lines": [
    {
      "itemVariantId": "clx2var001000000000000001",
      "qty": 50,
      "unitCost": 480
    }
  ]
}'

Example response

JSON
{
  "seeded": 1
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

GET/api/v1/inventory/transfers

List stock transfers

Scope: stock.read

The Transfers page, newest first. A transfer shows when either end is one of the member's warehouses.

Parameters

NameInTypeRequiredDescription
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/transfers" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2trf001000000000000001",
  "number": "TR-MFD1X2-AB12CD",
  "fromName": "Main Warehouse",
  "toName": "Chennai Store",
  "status": "IN_TRANSIT",
  "dispatchedAt": "2026-08-12T09:30:00.000Z",
  "receivedAt": null
}

Possible errors: unauthorized, insufficient_scope, forbidden

POST/api/v1/inventory/transfers

Create a stock transfer

Scope: inventory.create

Creates a DRAFT transfer; nothing moves until it is dispatched. 404 when a warehouse is unknown or outside the member's scope.

Request body

FieldTypeRequiredConstraints
fromWarehouseIdstringRequiredmin length 1; max length 30
toWarehouseIdstringRequiredmin length 1; max length 30
notesanyOptional—
linesarrayRequired—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/transfers" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "fromWarehouseId": "clx2wh0001000000000000001",
  "toWarehouseId": "clx2wh0002000000000000001",
  "notes": "Restock the Chennai store",
  "lines": [
    {
      "itemVariantId": "clx2var001000000000000001",
      "qty": 10
    }
  ]
}'

Example response

JSON
{
  "id": "clx2trf001000000000000001",
  "number": "TR-MFD1X2-AB12CD"
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found

GET/api/v1/inventory/transfers/{id}

Get a stock transfer

Scope: stock.read

The transfer with its lines, whether it crosses GST registrations (dispatch then takes e-way details), the self-supply invoice, and the actions (dispatch, receive, cancel) the member may take now.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredTransfer ID.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/transfers/clx2trf001000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2trf001000000000000001",
  "number": "TR-MFD1X2-AB12CD",
  "fromName": "Main Warehouse",
  "toName": "Chennai Store",
  "status": "IN_TRANSIT",
  "dispatchedAt": "2026-08-12T09:30:00.000Z",
  "receivedAt": null,
  "crossGstin": true,
  "selfSupplyInvoice": {
    "id": "clx2inv001000000000000001",
    "number": "INV-0042"
  },
  "lines": [
    {
      "itemName": "Cotton Fabric",
      "variantLabel": "Blue - 44in",
      "sku": "CF-BLUE-44",
      "qty": 10
    }
  ],
  "actions": [
    "receive",
    "cancel"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

POST/api/v1/inventory/transfers/{id}/dispatch

Dispatch a stock transfer

Scope: inventory.update

DRAFT to IN_TRANSIT: stock leaves the source warehouse. eway is optional, including between GST registrations; mode is ROAD, RAIL, AIR or SHIP and distanceKm is 1 to 4000. Answers with the refreshed detail, including the recomputed actions. 409 when the transfer's status doesn't allow it; 404 when the transfer or its warehouse is outside the member's scope.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredTransfer ID.

Request body

FieldTypeRequiredConstraints
ewayanyOptional—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/transfers/clx2trf001000000000000001/dispatch" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "eway": {
    "distanceKm": 350,
    "mode": "ROAD",
    "vehicleNumber": "TN01AB1234",
    "transporterName": "Fast Cargo"
  }
}'

Example response

JSON
{
  "id": "clx2trf001000000000000001",
  "number": "TR-MFD1X2-AB12CD",
  "fromName": "Main Warehouse",
  "toName": "Chennai Store",
  "status": "IN_TRANSIT",
  "dispatchedAt": "2026-08-12T09:30:00.000Z",
  "receivedAt": null,
  "crossGstin": true,
  "selfSupplyInvoice": {
    "id": "clx2inv001000000000000001",
    "number": "INV-0042"
  },
  "lines": [
    {
      "itemName": "Cotton Fabric",
      "variantLabel": "Blue - 44in",
      "sku": "CF-BLUE-44",
      "qty": 10
    }
  ],
  "actions": [
    "receive",
    "cancel"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

POST/api/v1/inventory/transfers/{id}/receive

Receive a stock transfer

Scope: inventory.update

IN_TRANSIT to RECEIVED: stock lands in the destination warehouse. No body. Answers with the refreshed detail, including the recomputed actions. 409 when the transfer's status doesn't allow it; 404 when the transfer or its warehouse is outside the member's scope.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredTransfer ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/transfers/clx2trf001000000000000001/receive" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2trf001000000000000001",
  "number": "TR-MFD1X2-AB12CD",
  "fromName": "Main Warehouse",
  "toName": "Chennai Store",
  "status": "RECEIVED",
  "dispatchedAt": "2026-08-12T09:30:00.000Z",
  "receivedAt": "2026-08-14T10:00:00.000Z",
  "crossGstin": true,
  "selfSupplyInvoice": {
    "id": "clx2inv001000000000000001",
    "number": "INV-0042"
  },
  "lines": [
    {
      "itemName": "Cotton Fabric",
      "variantLabel": "Blue - 44in",
      "sku": "CF-BLUE-44",
      "qty": 10
    }
  ],
  "actions": []
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found, conflict

POST/api/v1/inventory/transfers/{id}/cancel

Cancel a stock transfer

Scope: inventory.update

DRAFT or IN_TRANSIT to CANCELLED; in-transit stock returns to the source warehouse. No body. Answers with the refreshed detail, including the recomputed actions. 409 when the transfer's status doesn't allow it; 404 when the transfer or its warehouse is outside the member's scope.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredTransfer ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/transfers/clx2trf001000000000000001/cancel" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2trf001000000000000001",
  "number": "TR-MFD1X2-AB12CD",
  "fromName": "Main Warehouse",
  "toName": "Chennai Store",
  "status": "CANCELLED",
  "dispatchedAt": "2026-08-12T09:30:00.000Z",
  "receivedAt": null,
  "crossGstin": true,
  "selfSupplyInvoice": {
    "id": "clx2inv001000000000000001",
    "number": "INV-0042"
  },
  "lines": [
    {
      "itemName": "Cotton Fabric",
      "variantLabel": "Blue - 44in",
      "sku": "CF-BLUE-44",
      "qty": 10
    }
  ],
  "actions": []
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found, conflict

GET/api/v1/inventory/assembly-orders

List assembly orders

Scope: manufacturing.read

The Assembly Orders page, newest production date first, limited to the member's warehouses. status is DRAFT, COMPLETED or VOIDED; type is ASSEMBLY, REPACK or DISASSEMBLY. 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/assembly-orders" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2aso001000000000000001",
  "number": "AO-00012",
  "date": "2026-08-12T00:00:00.000Z",
  "type": "ASSEMBLY",
  "outputName": "Cotton Shirt",
  "qty": 50,
  "unitCost": 262,
  "totalCost": 13100,
  "warehouseName": "Main Warehouse",
  "status": "COMPLETED"
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

POST/api/v1/inventory/assembly-orders

Create an assembly order from a recipe

Scope: manufacturing.create

Saves a DRAFT ASSEMBLY order built from an active recipe exactly as the web form prefills it: each material's actual is planned plus the allowance. materials, when present, overrides the actual per itemVariantId (422 for a variant that is not a component of the recipe). A recipe for an item with several variants needs outputItemVariantId, one of the recipe's outputVariants (422 for anything else, and for a recipe with nothing to choose). productionDate cannot be in the future. 404 for an unknown recipe or a warehouse outside the member's scope; 422 for a draft or archived recipe. 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Request body

FieldTypeRequiredConstraints
bomIdstringRequiredmin length 1; max length 30
warehouseIdstringRequiredmin length 1; max length 30
productionDatestringRequired—
goodQtynumberRequired—
outputItemVariantIdanyOptional—
materialsanyOptional—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/assembly-orders" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "bomId": "clx2bom001000000000000001",
  "warehouseId": "clx2wh0001000000000000001",
  "productionDate": "2026-08-12",
  "goodQty": 50,
  "outputItemVariantId": "clx2var003000000000000001",
  "materials": [
    {
      "itemVariantId": "clx2var001000000000000001",
      "actual": 64
    }
  ]
}'

Example response

JSON
{
  "id": "clx2aso001000000000000001"
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found

GET/api/v1/inventory/assembly-orders/{id}

Get an assembly order

Scope: manufacturing.read

One order with its materials (planned, allowancePct, actual, variancePct, overAllowance), outputs, void reason and the actions the member may take now (complete, void). 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredAssembly order ID.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/assembly-orders/clx2aso001000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2aso001000000000000001",
  "number": "AO-00012",
  "date": "2026-08-12T00:00:00.000Z",
  "type": "ASSEMBLY",
  "outputName": "Cotton Shirt",
  "qty": 50,
  "unitCost": 262,
  "totalCost": 13100,
  "warehouseName": "Main Warehouse",
  "status": "COMPLETED",
  "recipe": {
    "id": "clx2bom001000000000000001",
    "label": "v1 · Standard"
  },
  "materials": [
    {
      "itemName": "Cotton Fabric",
      "planned": 60,
      "allowancePct": 5,
      "actual": 63,
      "variancePct": 5,
      "overAllowance": false,
      "unitCost": 150,
      "cost": 9450
    }
  ],
  "outputs": [
    {
      "itemName": "Cotton Shirt",
      "type": "Main output",
      "lotBarcode": "PRD-0000012",
      "qty": 50,
      "unitCost": 262,
      "value": 13100,
      "mrp": 999
    }
  ],
  "voidReason": null,
  "actions": [
    "void"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

POST/api/v1/inventory/assembly-orders/{id}/complete

Complete an assembly order

Scope: manufacturing.approve

DRAFT to COMPLETED: materials are consumed oldest lots first and the outputs are minted at the cost of what was used. No body. A second request is a 409 and posts nothing; 409 also when a material is short. Answers with the refreshed detail, including the recomputed actions. 409 when the order's status doesn't allow it; 404 when the order or its warehouse is outside the member's scope. 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredAssembly order ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/assembly-orders/clx2aso001000000000000001/complete" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2aso001000000000000001",
  "number": "AO-00012",
  "date": "2026-08-12T00:00:00.000Z",
  "type": "ASSEMBLY",
  "outputName": "Cotton Shirt",
  "qty": 50,
  "unitCost": 262,
  "totalCost": 13100,
  "warehouseName": "Main Warehouse",
  "status": "COMPLETED",
  "recipe": {
    "id": "clx2bom001000000000000001",
    "label": "v1 · Standard"
  },
  "materials": [
    {
      "itemName": "Cotton Fabric",
      "planned": 60,
      "allowancePct": 5,
      "actual": 63,
      "variancePct": 5,
      "overAllowance": false,
      "unitCost": 150,
      "cost": 9450
    }
  ],
  "outputs": [
    {
      "itemName": "Cotton Shirt",
      "type": "Main output",
      "lotBarcode": "PRD-0000012",
      "qty": 50,
      "unitCost": 262,
      "value": 13100,
      "mrp": 999
    }
  ],
  "voidReason": null,
  "actions": [
    "void"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

POST/api/v1/inventory/assembly-orders/{id}/void

Void an assembly order

Scope: manufacturing.delete

COMPLETED to VOIDED: stock is reversed. reason is required (trimmed, not blank, at most 255 characters). Refused with 409 when any of the output was already sold or used. Answers with the refreshed detail, including the recomputed actions. 409 when the order's status doesn't allow it; 404 when the order or its warehouse is outside the member's scope. 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredAssembly order ID.

Request body

FieldTypeRequiredConstraints
reasonstringRequiredmin length 1; max length 255

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/assembly-orders/clx2aso001000000000000001/void" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "Wrong quantity entered"
}'

Example response

JSON
{
  "id": "clx2aso001000000000000001",
  "number": "AO-00012",
  "date": "2026-08-12T00:00:00.000Z",
  "type": "ASSEMBLY",
  "outputName": "Cotton Shirt",
  "qty": 50,
  "unitCost": 262,
  "totalCost": 13100,
  "warehouseName": "Main Warehouse",
  "status": "VOIDED",
  "recipe": {
    "id": "clx2bom001000000000000001",
    "label": "v1 · Standard"
  },
  "materials": [
    {
      "itemName": "Cotton Fabric",
      "planned": 60,
      "allowancePct": 5,
      "actual": 63,
      "variancePct": 5,
      "overAllowance": false,
      "unitCost": 150,
      "cost": 9450
    }
  ],
  "outputs": [
    {
      "itemName": "Cotton Shirt",
      "type": "Main output",
      "lotBarcode": "PRD-0000012",
      "qty": 50,
      "unitCost": 262,
      "value": 13100,
      "mrp": 999
    }
  ],
  "voidReason": "Wrong quantity entered",
  "actions": []
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

GET/api/v1/inventory/boms

List recipes (bills of materials)

Scope: manufacturing.read

The Bills of Materials page, most recently changed first. status is DRAFT, ACTIVE or ARCHIVED; batchSize is the output quantity the recipe lines are written for. 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
statusquerystringOptionalOnly recipes in this status: DRAFT, ACTIVE or ARCHIVED.
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/boms" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2bom001000000000000001",
  "itemName": "Cotton Shirt",
  "version": 1,
  "label": "Standard",
  "status": "ACTIVE",
  "batchSize": 10,
  "componentCount": 2,
  "estCostPerUnit": 262
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

GET/api/v1/inventory/boms/{id}

Get a recipe

Scope: manufacturing.read

One recipe. components holds every line with its kind (COMPONENT, CO_PRODUCT, BY_PRODUCT or SCRAP), itemVariantId and unitFactor; byProducts is always empty. outputVariants lists {id, label} of the output item's active variants when the recipe is item-level and the item has several (pick one for outputItemVariantId when creating an order); otherwise it is empty. actions lists activate (draft) or archive (active). 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredRecipe (BOM) ID.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/boms/clx2bom001000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2bom001000000000000001",
  "itemName": "Cotton Shirt",
  "version": 1,
  "label": "Standard",
  "status": "ACTIVE",
  "batchSize": 10,
  "componentCount": 2,
  "estCostPerUnit": 262,
  "components": [
    {
      "itemName": "Cotton Fabric",
      "qtyPerBatch": 12,
      "unit": "M",
      "wastagePct": 5,
      "drawFromName": null,
      "estCost": 1890,
      "itemVariantId": "clx2var001000000000000001",
      "kind": "COMPONENT",
      "unitFactor": 1
    },
    {
      "itemName": "Fabric Waste",
      "qtyPerBatch": 0.5,
      "unit": "KG",
      "wastagePct": 0,
      "drawFromName": null,
      "itemVariantId": "clx2var002000000000000001",
      "kind": "SCRAP",
      "unitFactor": 1
    }
  ],
  "outputVariants": [],
  "byProducts": [],
  "actions": [
    "archive"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

POST/api/v1/inventory/boms/{id}/activate

Activate a recipe

Scope: manufacturing.approve

DRAFT to ACTIVE: the version freezes. No body. 409 when not a draft; 422 when the recipe cannot be produced (no components, an untracked item). Answers with the refreshed detail. 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredRecipe (BOM) ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/boms/clx2bom001000000000000001/activate" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2bom001000000000000001",
  "itemName": "Cotton Shirt",
  "version": 1,
  "label": "Standard",
  "status": "ACTIVE",
  "batchSize": 10,
  "componentCount": 2,
  "estCostPerUnit": 262,
  "components": [
    {
      "itemName": "Cotton Fabric",
      "qtyPerBatch": 12,
      "unit": "M",
      "wastagePct": 5,
      "drawFromName": null,
      "estCost": 1890,
      "itemVariantId": "clx2var001000000000000001",
      "kind": "COMPONENT",
      "unitFactor": 1
    },
    {
      "itemName": "Fabric Waste",
      "qtyPerBatch": 0.5,
      "unit": "KG",
      "wastagePct": 0,
      "drawFromName": null,
      "itemVariantId": "clx2var002000000000000001",
      "kind": "SCRAP",
      "unitFactor": 1
    }
  ],
  "outputVariants": [],
  "byProducts": [],
  "actions": [
    "archive"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

POST/api/v1/inventory/boms/{id}/archive

Archive a recipe

Scope: manufacturing.update

ACTIVE to ARCHIVED. No body. 409 when not active. Answers with the refreshed detail. 404 when the Manufacturing module is off. Cost fields (unitCost, totalCost, cost, value, estCost, estCostPerUnit) need costPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredRecipe (BOM) ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/boms/clx2bom001000000000000001/archive" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2bom001000000000000001",
  "itemName": "Cotton Shirt",
  "version": 1,
  "label": "Standard",
  "status": "ARCHIVED",
  "batchSize": 10,
  "componentCount": 2,
  "estCostPerUnit": 262,
  "components": [
    {
      "itemName": "Cotton Fabric",
      "qtyPerBatch": 12,
      "unit": "M",
      "wastagePct": 5,
      "drawFromName": null,
      "estCost": 1890,
      "itemVariantId": "clx2var001000000000000001",
      "kind": "COMPONENT",
      "unitFactor": 1
    },
    {
      "itemName": "Fabric Waste",
      "qtyPerBatch": 0.5,
      "unit": "KG",
      "wastagePct": 0,
      "drawFromName": null,
      "itemVariantId": "clx2var002000000000000001",
      "kind": "SCRAP",
      "unitFactor": 1
    }
  ],
  "outputVariants": [],
  "byProducts": [],
  "actions": []
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found, conflict

GET/api/v1/inventory/challans

List delivery challans

Scope: challans.read

The Delivery Challans page, newest first, limited to the member's source warehouses. date and expectedReturn are calendar days (YYYY-MM-DD, IST); status is DRAFT, ISSUED, CLOSED or CANCELLED; purpose is JOB_WORK, ON_APPROVAL, EXHIBITION, SAMPLES, REPAIR or OTHER; linesOut counts lines with goods still out. 404 when the Delivery challans module is off, or the challan's source warehouse is outside the member's scope. value (and each line's value) needs sellingPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/challans" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2chl001000000000000001",
  "number": "DC-00012",
  "date": "2026-11-01",
  "purpose": "ON_APPROVAL",
  "partyName": "Ravi Stores",
  "value": 3600,
  "expectedReturn": "2026-11-30",
  "linesOut": 1,
  "status": "ISSUED"
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

POST/api/v1/inventory/challans

Create a delivery challan

Scope: challans.create

Saves a DRAFT exactly as the web form validates it: JOB_WORK and REPAIR go to a VENDOR; ON_APPROVAL and SAMPLES to a CUSTOMER; EXHIBITION to a CUSTOMER or NONE; OTHER to any. partyId is the customer or vendor ID (required unless partyType is NONE). expectedReturnDate cannot be before challanDate. mode (at most 20 characters) is independent of transporter and vehicleNumber. Nothing moves until it is issued. 404 for a source warehouse outside the member's scope; 403 when the plan lacks challans. 404 when the Delivery challans module is off, or the challan's source warehouse is outside the member's scope. value (and each line's value) needs sellingPrice.read; without it the keys are absent.

Request body

FieldTypeRequiredConstraints
purposestringRequiredone of: JOB_WORK, ON_APPROVAL, EXHIBITION, SAMPLES, REPAIR, OTHER
partyTypestringRequiredone of: CUSTOMER, VENDOR, NONE
partyIdanyOptional—
sourceWarehouseIdstringRequiredmin length 1; max length 30
challanDatestringRequiredmin length 1
expectedReturnDatestring | nullOptional—
transporteranyOptional—
vehicleNumberanyOptional—
modeanyOptional—
notesanyOptional—
linesarrayRequired—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/challans" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "purpose": "ON_APPROVAL",
  "partyType": "CUSTOMER",
  "partyId": "clx2cus001000000000000001",
  "sourceWarehouseId": "clx2wh0001000000000000001",
  "challanDate": "2026-11-01",
  "expectedReturnDate": "2026-11-30",
  "transporter": "Fast Cargo",
  "vehicleNumber": "TN01AB1234",
  "mode": "ROAD",
  "notes": "Show the new range",
  "lines": [
    {
      "itemVariantId": "clx2var001000000000000001",
      "qty": 6
    }
  ]
}'

Example response

JSON
{
  "id": "clx2chl001000000000000001"
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found

GET/api/v1/inventory/challans/{id}

Get a delivery challan

Scope: challans.read

The row fields plus sourceWarehouseId, progress (sent, returned, invoiced, writtenOff, stillOut, summed over the lines), lines (id is what return and write-off address a line by), returns, invoices, the e-way bill (read-only: {number, validUntil} or null) and the actions (issue, return, convert, writeOff, cancel) the member may take now (convert is absent while its draft invoice is waiting). ewayBill.validUntil is an ISO datetime. 404 when the Delivery challans module is off, or the challan's source warehouse is outside the member's scope. value (and each line's value) needs sellingPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredDelivery challan ID.

Example request

curl "https://invoice.avscorp.in/api/v1/inventory/challans/clx2chl001000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2chl001000000000000001",
  "number": "DC-00012",
  "date": "2026-11-01",
  "purpose": "ON_APPROVAL",
  "partyName": "Ravi Stores",
  "value": 3600,
  "expectedReturn": "2026-11-30",
  "linesOut": 1,
  "status": "ISSUED",
  "sourceWarehouseId": "clx2wh0001000000000000001",
  "progress": {
    "sent": 6,
    "returned": 2,
    "invoiced": 0,
    "writtenOff": 0,
    "stillOut": 4
  },
  "lines": [
    {
      "id": "clx2cli001000000000000001",
      "itemName": "Cotton Fabric",
      "sent": 6,
      "returned": 2,
      "invoiced": 0,
      "writtenOff": 0,
      "stillOut": 4,
      "value": 3600
    }
  ],
  "returns": [
    {
      "number": "DC-00012/R1",
      "date": "2026-11-05",
      "lines": 1
    }
  ],
  "invoices": [],
  "ewayBill": null,
  "actions": [
    "return",
    "convert",
    "writeOff",
    "cancel"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

POST/api/v1/inventory/challans/{id}/issue

Issue a delivery challan

Scope: challans.update

DRAFT to ISSUED: stock moves out of the source warehouse to Out on challan and the challan number is assigned. No body. A second request is a 409 and moves nothing; 409 also when a line is short. Answers with the refreshed detail, including the recomputed actions. 409 when the challan's status doesn't allow it. 404 when the Delivery challans module is off, or the challan's source warehouse is outside the member's scope. value (and each line's value) needs sellingPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredDelivery challan ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/challans/clx2chl001000000000000001/issue" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2chl001000000000000001",
  "number": "DC-00012",
  "date": "2026-11-01",
  "purpose": "ON_APPROVAL",
  "partyName": "Ravi Stores",
  "value": 3600,
  "expectedReturn": "2026-11-30",
  "linesOut": 1,
  "status": "ISSUED",
  "sourceWarehouseId": "clx2wh0001000000000000001",
  "progress": {
    "sent": 6,
    "returned": 2,
    "invoiced": 0,
    "writtenOff": 0,
    "stillOut": 4
  },
  "lines": [
    {
      "id": "clx2cli001000000000000001",
      "itemName": "Cotton Fabric",
      "sent": 6,
      "returned": 2,
      "invoiced": 0,
      "writtenOff": 0,
      "stillOut": 4,
      "value": 3600
    }
  ],
  "returns": [
    {
      "number": "DC-00012/R1",
      "date": "2026-11-05",
      "lines": 1
    }
  ],
  "invoices": [],
  "ewayBill": null,
  "actions": [
    "return",
    "convert",
    "writeOff",
    "cancel"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found, conflict

POST/api/v1/inventory/challans/{id}/return

Record a return against a challan

Scope: challans.update

Takes goods back into warehouseId (404 when unknown or outside the member's scope). lines[].lineId is the challan line id from the detail; qty is in the line's unit and cannot exceed its stillOut (422); lines with qty 0 are ignored and at least one must be above 0. damaged defaults to false. date is not before the challan date. The party challan number and date are optional. Answers with the refreshed detail, including the recomputed actions. 409 when the challan's status doesn't allow it. 404 when the Delivery challans module is off, or the challan's source warehouse is outside the member's scope. value (and each line's value) needs sellingPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredDelivery challan ID.

Request body

FieldTypeRequiredConstraints
datestringRequiredmin length 1
warehouseIdstringRequiredmin length 1; max length 30
partyChallanNumberanyOptional—
partyChallanDatestring | nullOptional—
linesarrayRequired—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/challans/clx2chl001000000000000001/return" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "date": "2026-11-05",
  "warehouseId": "clx2wh0001000000000000001",
  "lines": [
    {
      "lineId": "clx2cli001000000000000001",
      "qty": 2,
      "damaged": false
    }
  ]
}'

Example response

JSON
{
  "id": "clx2chl001000000000000001",
  "number": "DC-00012",
  "date": "2026-11-01",
  "purpose": "ON_APPROVAL",
  "partyName": "Ravi Stores",
  "value": 3600,
  "expectedReturn": "2026-11-30",
  "linesOut": 1,
  "status": "ISSUED",
  "sourceWarehouseId": "clx2wh0001000000000000001",
  "progress": {
    "sent": 6,
    "returned": 2,
    "invoiced": 0,
    "writtenOff": 0,
    "stillOut": 4
  },
  "lines": [
    {
      "id": "clx2cli001000000000000001",
      "itemName": "Cotton Fabric",
      "sent": 6,
      "returned": 2,
      "invoiced": 0,
      "writtenOff": 0,
      "stillOut": 4,
      "value": 3600
    }
  ],
  "returns": [
    {
      "number": "DC-00012/R1",
      "date": "2026-11-05",
      "lines": 1
    }
  ],
  "invoices": [],
  "ewayBill": null,
  "actions": [
    "return",
    "convert",
    "writeOff",
    "cancel"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

POST/api/v1/inventory/challans/{id}/convert

Convert a challan to an invoice

Scope: challans.update

Converts every line still out into a DRAFT invoice for the challan's customer and answers { invoiceId }. Needs challans.update and invoices.create (403 without). 409 when the purpose is not convertible (job work, repair, other), the challan is not issued, nothing is still out, or it was already converted. No body.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredDelivery challan ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/challans/clx2chl001000000000000001/convert" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "invoiceId": "clx2inv001000000000000001"
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found, conflict

POST/api/v1/inventory/challans/{id}/write-off

Write off goods that will not come back

Scope: challans.approve

Writes off part of what is still out. reason is 3 to 255 characters after trimming; qty per line cannot exceed its stillOut (422), lines with qty 0 are ignored and at least one must be above 0. Needs challans.approve. Answers with the refreshed detail, including the recomputed actions. 409 when the challan's status doesn't allow it. 404 when the Delivery challans module is off, or the challan's source warehouse is outside the member's scope. value (and each line's value) needs sellingPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredDelivery challan ID.

Request body

FieldTypeRequiredConstraints
reasonstringRequired—
linesarrayRequired—

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/challans/clx2chl001000000000000001/write-off" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "Lost in transit",
  "lines": [
    {
      "lineId": "clx2cli001000000000000001",
      "qty": 1
    }
  ]
}'

Example response

JSON
{
  "id": "clx2chl001000000000000001",
  "number": "DC-00012",
  "date": "2026-11-01",
  "purpose": "ON_APPROVAL",
  "partyName": "Ravi Stores",
  "value": 3600,
  "expectedReturn": "2026-11-30",
  "linesOut": 1,
  "status": "ISSUED",
  "sourceWarehouseId": "clx2wh0001000000000000001",
  "progress": {
    "sent": 6,
    "returned": 2,
    "invoiced": 0,
    "writtenOff": 0,
    "stillOut": 4
  },
  "lines": [
    {
      "id": "clx2cli001000000000000001",
      "itemName": "Cotton Fabric",
      "sent": 6,
      "returned": 2,
      "invoiced": 0,
      "writtenOff": 0,
      "stillOut": 4,
      "value": 3600
    }
  ],
  "returns": [
    {
      "number": "DC-00012/R1",
      "date": "2026-11-05",
      "lines": 1
    }
  ],
  "invoices": [],
  "ewayBill": null,
  "actions": [
    "return",
    "convert",
    "writeOff",
    "cancel"
  ]
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error, not_found, conflict

POST/api/v1/inventory/challans/{id}/cancel

Cancel an issued challan

Scope: challans.approve

ISSUED to CANCELLED: all goods go back to the source warehouse. No body. 409 when anything was returned, invoiced or written off, or a live e-way bill exists (the e-way bill is managed on the web). Needs challans.approve. Answers with the refreshed detail, including the recomputed actions. 409 when the challan's status doesn't allow it. 404 when the Delivery challans module is off, or the challan's source warehouse is outside the member's scope. value (and each line's value) needs sellingPrice.read; without it the keys are absent.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredDelivery challan ID.

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/inventory/challans/clx2chl001000000000000001/cancel" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx2chl001000000000000001",
  "number": "DC-00012",
  "date": "2026-11-01",
  "purpose": "ON_APPROVAL",
  "partyName": "Ravi Stores",
  "value": 3600,
  "expectedReturn": "2026-11-30",
  "linesOut": 0,
  "status": "CANCELLED",
  "sourceWarehouseId": "clx2wh0001000000000000001",
  "progress": {
    "sent": 6,
    "returned": 2,
    "invoiced": 0,
    "writtenOff": 0,
    "stillOut": 4
  },
  "lines": [
    {
      "id": "clx2cli001000000000000001",
      "itemName": "Cotton Fabric",
      "sent": 6,
      "returned": 2,
      "invoiced": 0,
      "writtenOff": 0,
      "stillOut": 4,
      "value": 3600
    }
  ],
  "returns": [
    {
      "number": "DC-00012/R1",
      "date": "2026-11-05",
      "lines": 1
    }
  ],
  "invoices": [],
  "ewayBill": null,
  "actions": []
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found, conflict