Skip to main content
Version: Next (unreleased)

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 a cursor-paginated list of inventory records across all locations, newest-first.

Query parameters: limit (1–200, default 50), cursor (opaque). See Pagination.

curl 'https://<your-tenant>.datamingle.ai/api/integrations/v1/inventory/?limit=100' \
-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}
],
"pagination": {"limit": 100, "next_cursor": "eyJjIjoi..."}
}

Get inventory by location or SKU

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

Two-way lookup controlled by the ?by query parameter.

?by{identifier} isReturns
location (default)A location_codeEvery SKU held at that location
skuA sku_codeEvery location holding that SKU

An empty array means no matching records exist.

Response shape (uniform for both modes)

{
"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 everything at a location (default)

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

?by=location is the default and may be omitted.

Find every location holding a SKU

curl 'https://<your-tenant>.datamingle.ai/api/integrations/v1/inventory/RUG-5X7-BLU/?by=sku' \
-H "X-API-Key: sk_live_..."
{
"success": true,
"data": [
{"location_code": "A-101", "sku_code": "RUG-5X7-BLU", "quantity": 150},
{"location_code": "B-201", "sku_code": "RUG-5X7-BLU", "quantity": 200}
]
}

Errors

StatusCodeWhen
400VALIDATION_ERRORby is present but not location or sku