Skip to main content
Version: 1.0

Inventory

Set and query on-hand quantities by location and product.

  • Base path: /api/integrations/v1/inventory/
  • Required scope: integrations.inventory.{read|write} — see Scopes.
info

Inventory isn't a per-record CRUD resource. A record represents the quantity of a product at a location. Quantities are upserted through a single bulk endpoint.


Bulk set inventory

POST /api/integrations/v1/inventory/

Upserts one or more (location, product) pairs. Existing records are updated; missing ones are created.

Body

FieldTypeRequiredDescription
inventoryarrayYesNon-empty list of records
inventory[].location_codestringYesLocation code
inventory[].sku_codestringYesProduct SKU
inventory[].quantityintegerYesMinimum 0
sourcestringNobulk_import, manual_adjustment, erp_sync, initial_load (default bulk_import)
notesstringNoFree-form
curl -X POST https://<your-tenant>.datamingle.ai/api/integrations/v1/inventory/ \
-H "X-API-Key: sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"inventory": [
{"location_code": "A-101", "sku_code": "RUG-5X7-BLU", "quantity": 150},
{"location_code": "A-101", "sku_code": "RUG-8X10-RED", "quantity": 75},
{"location_code": "B-201", "sku_code": "RUG-5X7-BLU", "quantity": 200}
],
"source": "erp_sync",
"notes": "Daily inventory sync"
}'

Response 200 OK

{
"success": true,
"data": {
"total": 3,
"created": 2,
"updated": 1,
"failed": 0,
"errors": []
}
}

Partial failure

Rows are evaluated independently. Invalid rows are reported in errors[]; valid rows still succeed.

{
"success": true,
"data": {
"total": 3,
"created": 2,
"updated": 0,
"failed": 1,
"errors": [
{
"row": 2,
"location_id": "INVALID-LOC",
"product_id": "RUG-5X7-BLU",
"errors": {"location_id": ["Location not found"]}
}
]
}
}

Errors

StatusCodeWhen
400VALIDATION_ERRORinventory missing, empty, or not a list
422MAPPING_ERRORMapping engine failed

List inventory

GET /api/integrations/v1/inventory/

Returns up to 100 records across all locations. See Pagination.

curl https://<your-tenant>.datamingle.ai/api/integrations/v1/inventory/ \
-H "X-API-Key: sk_live_..."

Response 200 OK

{
"success": true,
"data": [
{"location_code": "A-101", "sku_code": "RUG-5X7-BLU", "quantity": 150},
{"location_code": "A-101", "sku_code": "RUG-8X10-RED", "quantity": 75}
]
}

Get inventory by location

GET /api/integrations/v1/inventory/{location_code}/

Returns every record for a given location. An empty array means the location exists but carries no inventory.

curl https://<your-tenant>.datamingle.ai/api/integrations/v1/inventory/A-101/ \
-H "X-API-Key: sk_live_..."

Response 200 OK

{
"success": true,
"data": [
{"sku_code": "RUG-5X7-BLU", "quantity": 150},
{"sku_code": "RUG-8X10-RED", "quantity": 75}
]
}